Rebirth of T-rex

Does dinosaur really extinct? What caused the dinosaur to vanish? Have you ever wonder whether the real 'you' is disappearing and slowly vanishing? Hope that through this blog, we will be able to maintain the real self.

Introduction to Portal and Portlet

Posted by T-rex Lim Huat Heng

The following are important points extracted from the JSR 168 Portlet Specification for quick reference. Please download the Java API and specification from the above hyperlink for further details.

What is a Portal?

=> A web based application that commonly provides personalization, single sign on, content aggregation from different sources and hosts the presentation layer of Information Systems.

Portal pages may have different set of portlets creating content for different users.

What is a Portlet?

=> A Java technology based web component, managed by a portlet container, that processes requests and generates dynamic content.

Portlets are used by portals as pluggable user interface components that provide a presentation layer to Information System.

Lifecycle of portlet is managed by the portlet container.

Fragment => Content generated by a portlet. A piece of markup (eg. HTML, XHTML, XML) adhering to certain rules and can be aggregated with the content of other portlets to form the portal page. May vary from one user to another depending on the user configuration for the portlet.

Web clients interact with (usually the content produced by) portlets via a request/response paradigm implemented by the portal. Eg. by following a links or submitting forms -> portlet actions received by the portal, forwarded to the portlets targeted by user's interactions.

What is a Portlet Container?

=> runs portlets and provides them with the required runtime environment.

Contains portlets and manages their lifecycle. Also provides persistent storage for portlet preferences.

Receives requests from the portal to execute requests on the portlets hosted by it.

Not responsible for aggregating the content produced by the portlets (but portal's responsibility to handle it).

A portal and a portlet container can be built together as a simple component of an application suite or as two separate components of a portal application.

An Example

A typical sequence of events, initiated when users access the portal page:

  • A client (eg. a web browser) after being authenticated makes an HTTP request to the portal
  • The request is received by the portal
  • The portal determines if the request contains an action targeted to any of the portlets associated with the portal page
  • If there is an action targeted to a portlet, the portal requests the portlet container to invoke the portlet to process the action
  • A portal invokes portlets, through the portlet container, to obtain content fragments that can be included in the resulting portal page
  • The portal aggregates the output of the portlets in the portal page and sends the portal page back to the client

'Sneak Preview' of Açaí Berry

Posted by T-rex Lim Huat Heng

Recently, I have just come across an interesting fruit, in particularly the Açaí Berry. The more I research on this 'super fruit', the more I am getting excited on the benefits it brings. Since I may take slightly longer time to compile more details in this blog, let me provide you some 'sneak preview' of it. The following information are quoted from other resources.

Açaí Berry- The Gift of Nature

Hidden deep within the Amazon rainforest of Brazil is a small, dark berry that posses scientific properties claimed by no other fruit. This deep purple, grape sized, nutrient dense fruit grows at the top of towering Açaí trees. It boasts the protein profile of an egg, a fatty acid ratio similar to olive oil, and has more than 30 times the antioxidant power of red grapes. It also packs vitamin B1, B2, B3, E, and C, phosphorus, calcium, potassium, and fiber.

Oprah Winfrey touts the Açaí Berry as the #1 food to keep you looking and feeling younger

Dr. Nicholas Perricone calls the Açaí Berry "one of the most nutritious and powerful foods in the world."

My First Sample Java Application on Facebook

Posted by T-rex Lim Huat Heng

Since Mandy introduced Facebook to me, I am kind of addicted to it. I admit that it's one of the 'must-open' application when I start my notebook, besides my Microsoft Outlook.

However, since I am a developer myself, passion for Java language, I have always been interested to try out a Java application deployed on Facebook.

Then, I found out a very good tutorial with video guiding how to build and deploy a sample Java application on Facebook. I have to admit that I really need to thank The Screencast Blog to help me kick start my trial.

Since the blog was written in June 2007, I believe there are a number of changes to the Facebook API, I was stucked following the sample provided (with compilation error and NullPointerException). For instance, someone suggested the usage of FacebookRestClient class needs to be replaced by FacebookXmlRestClient.

I have looked at several other blogs including the Javablog and T=Machine for references, but to no avail as these blogs were written last year also.

Although it may seem that I can't proceed further with the lack of documentation on Java application for Facebook, but as usual, it's not the end of the world, Google comes to my rescue! Google Code provides a wrapper- the Facebook-Java-API that solves my problem. The Javadoc is also available for reference.

Therefore, the following are simplified steps to produce my first sample Java application on Facebook (based on The Sceencast Blog example).

My development environment:


In Facebook

  1. Login to Facebook using your valid account (register one if you don't have).

  2. Access Developer application, click Add Application button on the top right panel.

  3. Then click on Add Developer button. A confirmation message is shown upon successful addition of the application.

  4. Go to the application Developer. Then, click + Set Up New Application button.

  5. Enter the Application Name (as MyFirstSampleFacebookJavaApp) and select the check box. Then, click Submit button. API Key is created. Note that the API Key and Secret key values are required later.

  6. Click Edit Settings link. Key in the Callback Url as http://localhost:8080/MyFirstSampleFacebookJavaApp/LoginServlet (This is the URL to the Java Servlet that will be created below). Then, click Save button.

In Eclipse

  1. Select from menu File > New > Project...
  2. Select Web > Dynamic Web Project in the New Project pop-up window. Then, click Next > button.
  3. Key in the Project name and select Target Runtime with the following values. Then, click Next > button.

    • Project name: MyFirstSampleFacebookJavaApp
    • Target Runtime: JBoss

  4. Ensure the version of Dynamic Web Module and Java are correct. Then, click Next > button and Finish button.

    • Dyname Web Module: 2.5
    • Java: 6.0

  5. Click on Yes when prompted to change to J2EE perspective.
  6. Add Facebook Java API JAR (facebook-java-api-1.7.3.jar) and JSON JAR (json-1.0.jar) into the WEB-INF\lib folder
  7. Add the source code (downloaded from the SVN) into the src folder.
  8. Right click on the project name and select New > Other... from the pop-up menu. Then, select Web > Servlet and click Next > button.
  9. Enter the Java package and Class name with the following values. Then, click Next > button. Please note that if the Java package is refactored after this step, the web.xml need to be amended accordingly.

    • Java package:
    • Class name: LoginServlet

  10. Add Initialization Parameters by clicking the Add... button. First add the parameter API_KEY with the following values, then click OK button.

    • Name: API_KEY
    • Value: (value in Facebook stated in Step 5 above. eg. 121036f141717859e681df3522bb04ec)

  11. Repeat the above step for parameter SECRET_KEY. Then, click OK button, followed by Next > button and Finish button.

    • Name: SECRET_KEY
    • Value: (value in Facebook stated in Step 5 above. eg. 87acfde11abd748f24e03bf5612bac62)

  12. Add the following code into doGet method.

    • String apiKey = getServletConfig().getInitParameter("API_KEY");
      String secretKey = getServletConfig().getInitParameter("SECRET_KEY");
      FacebookRestClient fbRestClient = null;
      HttpSession session = request.getSession();
      String sessionKey = (String) session.getAttribute("facebookSession");
      String token = request.getParameter("auth_token");
      if(sessionKey != null && sessionKey.length() > 0) {
      fbRestClient = new FacebookRestClient(apiKey, secretKey, sessionKey);
      else if(token != null) {
      fbRestClient = new FacebookRestClient(apiKey, secretKey);
      try {
      sessionKey = fbRestClient.auth_getSession(token);
      session.setAttribute("facebookSession", sessionKey);
      catch (FacebookException e) {
      else {
      response.sendRedirect("" + apiKey + "&v=1.0");
      playWithFacebookAPI(request, fbRestClient);
      request.getRequestDispatcher("info.jsp").forward(request, response);

  13. Add a new method playWithFacebookAPI with the following code.

    • private void playWithFacebookAPI(HttpServletRequest request,
      FacebookRestClient fbRestClient) {
      try {
      long myId = fbRestClient.users_getLoggedInUser();
      EnumSet<ProfileField> fields = EnumSet.of(ProfileField.NAME, ProfileField.PIC);
      Collection<Long> users = new ArrayList();
      Document d = fbRestClient.users_getInfo(users, fields);
      String name = d.getElementsByTagName("name").item(0).getTextContent();
      String picture = d.getElementsByTagName("pic").item(0).getTextContent();
      request.setAttribute("name", name);
      request.setAttribute("picture", picture);
      } catch (FacebookException e) {
      } catch (IOException e) {

  14. Right click on the project name and select New > Other... from the pop-up menu. Then, select Web > JSP and click Next > button.
  15. Key in the File name as info.jsp, then, click Next > button.
  16. Select New JSP file (xhtml) as the JSP Template and click Finish button.
  17. Modify the JSP to have the following content (an extract)

    • <title>My First Sample Facebook Java Application</title>
    • <body>
      ${ }
      <img src="${requestScope.picture }"></img>

  18. Publish the application to the JBoss server. In Servers view, right click on the JBoss 4.2 and select Publish from the pop-up menu. (If it is the first time, right click on the project name, select Run As > Run on Server from the pop-up menu. Then select JBoss 4.2 from the list and click Next > button. Select MyFirstSampleFacebookJavaApp and click Add > button. Next click Finish button.)

In Browser

  1. Access http://localhost:8080/MyFirstSampleFacebookJavaApp/LoginServlet

  2. Login with valid Email and Password. Then, click Login button.

  3. Click Log in to MyFirstSampleFacebookJavaApp button.

  4. The page will show the user id and photo of the user.

A 'Heart' Alert

Posted by T-rex Lim Huat Heng

Upon returning from lunch, Ming, our colleague who didn't join us for lunch, told us that his friend, at his 30s, just diagnosed with coronary artery clog. My first reaction was, 'Ming, what did you just said?' Ming answered, 'My friend who is on his 30 plus just got a heart attack and need to undergo an operation (which I believe is called Angioplasty)'. After trying to find out more information from him, I shared with him what I have encountered two years back during my dad's stay in the hospital after a surgery.

During that time, my dad was suffering from water clogging in his brain as one of the side effects from the radiotherapy. I guess you must be wonder why water clog in the brain after the radiotherapy. Based on my understanding from the doctor, there are cells in our brain that are 'in-charge' of draining off water from the brain to be 'released' from our body. However, many of those cells were dead after the radiotherapy and water was not drained off, thus clogging in the brain.

Doctor has installed a B-P shunt to regulate the water in his brain, such that the 'extra' ones are drained off to his bladder through the narrow tube embedded within his body near the skin surface. He was there for the 'maintenance', to replace a small part of the tube that was clogged by tiny dead cells.

It was during that time, I saw a young man, at his 20s was admitted to this wad and was in coma state. Later we found out, he was working in KL and suddenly colapsed. Apparently they found that the blood vessels in his brain burst. He did not make it and passed away in the morning on the same day my dad was discharged from the hospital. I saw the sorrow of his crying family members upon receiving the bad news.

As I was writing this blog, I come across the website of 'CRY' for Cardiac Risk in the Young - Sudden Cardiac Death (SCD), Sudden Death Syndrome (SDS). Once you enter the page, you will realize the highlighted statement of 'Every week, 8 'apparently' fit and healthy young people die in the UK from undiagnosed heart conditions.' At the same time, I also come across a useful nutritional tips for healthy heart by Julie Upton at Howstuffworks, which may be useful for our reference.

In fact, when I was on my way back home on the LRT, I was telling myself that I have a piece of important source of information about heart health and I must try to share with Ming and the rest at the soonest. Since it's part of my life crusade to help 1 million people through knowledge sharing, that's my duty to share about what I have learnt from a doctor who have survived for more than 25 years after suffered from two cancers. I met this doctor two years back in Singapore. I felt gratitute even though I had travelled all the way from KL to Singapore to attend her health seminar.

I understand the sense of urgency more this time, as I have also gone through several occasions of 'it's too late' and eventually the person I was trying to share the information with died not long after that. Therefore, Ming, please give me a day or two to compile what I have. I will be able to share with you at the soonest and hope that will also help you friend who have successfully gone through the surgery.

The Difference Maker

Posted by T-rex Lim Huat Heng

I just bought the book, The Difference Maker-Making Your Attitude Your Greatest Asset, by John C Maxwell yesterday before attending a dinner with our team mates.

I can't wait to start reading it today and found that although the book may appears 'small', but it is full of essence. I would like to quote some valuable ones to be shared with you. However, I will encourage you to read the entire book and it may change your life entirely.

'Attitude isn't everything, but it is one thing that can make a difference in your life.' ~ John C Maxwell

'There is a little difference in people, but the little difference makes a big difference. The little difference is attitude. The big difference is whether it is positive or negative.' ~ W. Clement Stone

'I think of attitude as an inward feeling expressed by outward behavior.' ~ John C Maxwell

'Where did I get my attitude?
- Personality- Who You Are
- Environment- What's Around You
- The Expression of Others- What You Feel
- Self-Image- How You See Yourself
- Exposure to Growth Opportunities- What You Experience
- Association with Peers- Who You Are With
- Belief- What You Think
- Choices- What You Do' ~ John C Maxwell

'Examine the labels you apply to yourself. Every label is a boundary or limit you will not let yourself cross.' ~ Dwayne Dyer

'The sum of all your thoughts comprises your overall attitude' ~ John C Maxwell

'To change your life, you must make a choice to take responsibility for your attitude, and to do everything you can to make it work for you. Your attitude truly can become a difference maker. It's up to you.' ~ John C Maxwell

The Christmas Present

Posted by T-rex Lim Huat Heng

I have just finished reading The Present by Dr. Spencer Johnson and found it useful to share some useful points with you, which hope will be a great Christmas Present for you. This book was recommended by another friend whom I met on Skype. Thanks to her.

The following is quoted from the book:

The Present

Focus on What is Right Now.
Use Your Purpose To Respond
To What Is Important Now.

Look At What Happened In The Past.
Learn Something Valuable From It.
Do Things Differently In The Present.

See What A Wonderful Future Would Look Like.
Make Plans to Help It Happen.
Put Your Plan Into Action In The Present.


Posted by T-rex Lim Huat Heng

I am currently reading the book- The AirAsia Story by Sen Ze and Jayne Ng and found the following quoted from Tony very interesting!

Believe the unbelievable, Dream the impossible, Don't take 'no' for an answer.

Hope it helps you.

Follow Your Heart

Posted by T-rex Lim Huat Heng

I would like to share important concepts extracted from Andrew Matthew's Follow Your Heart- Finding Purpose in Your Life and Work. It's a book really worth reading.

  1. We are here to learn lessons, and the world is our teacher
    When we fail to learn a lessson, we get to take it again... and again! Once we have learned the lesson, we move on to the next one. (And we never run out of lessons!)
  2. The universe has no favourtites
    Your success and happiness depend on natural laws and principles- and how you use them
  3. Your life is a perfect reflection of your beliefs
    When you change your deepest beliefs about the world, your life changes accordingly
  4. The moment you get too attached to things, people, money... you screw it up
    The challenge of life is to appreciate everything and attach yourself to nothing
  5. What you focus on in life expands
    so think about what you want!
  6. Follow your heart!
    Your mission in life is not to be without problems- your mission is to get excited.
  7. God is never going to come down from a cloud and say, "You now have permission to be successful!"
    You have to give yourself permission
  8. When you fight life, life always wins
    If you want more peace of mind, stop labelling everything that happens as 'good' or 'bad'
  9. How do you love people? Just accept them
    Complete acceptance is unconditional love
  10. Our mission in life is not to change the world- our mission is to change ourselves.
    There are no 'outside' solutions, only 'inside' solutions

Don't be color blind

Posted by T-rex Lim Huat Heng

I was happy to meet up my friend from Singapore yesterday. I have learnt so much things from him and one of the interesting concepts is 'Don't be Color Blind'.
The concept is simple yet useful. Basically, we can group our activities into 3 different colors- Red, Yellow and Green. Yes, just like the traffic light.

Red- Activities that do not move you at all to your objectives/goals, just like stopping at the traffic light when it is red.
Yellow- Activities that prepare you to move closer to your objectives/goals.
Green- Activities that makes you achieve your objectives/goals.

Therefore, when you are selecting your activities within the fairly allocated 1440 minutes everyday, don't be color blind and choose your activities wisely. Keep performing as many green activities without being caught in red activities.

After understanding it, I come to realized that there are similarities in this concept with the others that I have learnt before this.

Habit 4 of First Thing First by Steven Covey in the 7 Habits of Highly Effective People, in which you should focus on the 2nd Quadrant of activities that are important but not urgent.

Besides, Eat That Frog by Brian Tracy also adviced that you should prioritize your daily activities by 'eating the biggest, ugliest frog' in the beginning of the day.

In short, focus on the Most Important activities that brings you closer in achieving your objectives/goals and dreams!

Mission Statement

Posted by T-rex Lim Huat Heng

I would like to share my mission statement that was defined after the 7th Habits of Highly Effective People training.

Mission Statement

  1. Financial Arena- I shall seek financial freedom and consequently freedom to do the things I want to do by managing my wealth with proper financial planning
  2. Career Arena- I shall build a career preferably owning a business) that saves lives and change people lifestyles) alternatively “that brings benefits to people”
  3. Recreational Arena- I shall pursue recreational activities that nurture and build deeper personal and family relationships
  4. Health Arena- I shall maintain a healthy body (physically, mentally, spiritually and socially) via healthy diet, consistent exercise, open and positive mindset and meditation that is full of vitality, free from diseases, calm and relax, friendly and sociable
  5. Relationship Arena- I shall build a healthy relationship with family and friends, in which we are caring, loving, empowering and supportive to each other
  6. Personal Arena- I shall seek continuous learning and improving through self-development (Travel around the world, Attend motivational seminars by idol [Anthony Robbins, Bob Proctor, Jack Canfield, Jim Rohn] and Pursue post-graduate education)
  7. Community Arena- I shall contribute to the community by actualizing my goal of helping 1 million people by 2019 by being a successful leader, mentor/ coach in leading, educating, inspiring others to achieve their success (Live, Love, Learn and Leave a Legacy)

Beijing Trip 2007

Posted by T-rex Lim Huat Heng

Visiting another country in the early of new year was a great experience, especially in a new environment with difference weather, culture and history background.

Just returned from Beijing yesterday and eagerly wanting to share the experience during the great trip.

The following are a summary of the destinations during the trip.

6th Jan 2007: KLIA International Airport -> Beijing Capital International Airport

7th Jan 2007: Beijing Capital International Airport -> Breakfast -> TianAnMen Square -> Forbidden City -> Lunch (GuangDong Cuisine) -> Jade Factory -> YiHao Hotel -> Tea Shop -> Dinner

8th Jan 2007: YiHao Hotel (Breakfast) -> Great Wall of China (BaDaLing) -> Lunch (HangZhou Cuisine) -> YueXie Market -> Ya Xiu Market -> Crystal -> Ming Dynasty Museum -> BaoFuTang -> Dinner (Hot Mutton Pot) -> Acrobatic Show

9th Jan 2007: YiHao Hotel (Breakfast) -> Summer Palace -> Pearl Shop -> Lunch (Peking Roast Duck) -> HuTong Trishaw Ride -> Visit Old Beijing Area (Interview Resident) -> Dinner (Guang Dong Claypot) -> WangFuJing

10th Jan 2007: YiHao Hotel (Breakfast) -> ZhengYangMen City Gate (FengShui Center) -> Lunch (SiChuanMaLa Fish) -> JinJie Market -> YueXiu Market -> Dinner (ChaoZhou Cuisine) -> ShaoLingKungFu Show -> ShiShaHai Bar Street

11th Jan 2007: YiHao Hotel (Breakfast) -> JinTaiLan -> Underground City (Silk) -> Lunch (ShanXi Noodle) -> YueXiu Market -> Beijing Capital International Airport

Besides, I would like to share some photos taken during the trip to provide a 'snapshot' of these places.

Image Hosted by
With handsome tour guide-Jerry Li Xiang at TianAnMen Square

Image Hosted by
At WuMen of Forbidden City

Image Hosted by
Briefing in Jade Factory

Image Hosted by
At mid of the BaDaLing Great Wall of China

Image Hosted by
At Summer Palace

Image Hosted by
Extraction of Pearl in Pearl Shop

Image Hosted by
Trishaw ride in HuTong to visit old Beijing area

Image Hosted by
At WangFuJing (temperature was -6 degree)

Image Hosted by
View of ZhengYangMen City Gate

Image Hosted by
Photo with ShaoLinKungFu Masters

Image Hosted by
Huge vase in JinTaiLan

Image Hosted by
Minute work by JinTaiLan

Image Hosted by
Part of the tunnel in Beijing Underground City

Image Hosted by
Photo with handsome tour guide and pretty photographer during the last lunch in Beijing

Review of 2006

Posted by T-rex Lim Huat Heng

Tomorrow will be the last day of 2006, looking back at the events happened and achievements obtained, there are 5 significant ones that I extremely happy about and satisfied with.

In short, they are the following:

  1. A New Year Resolution of 2006
  2. Career in MNC
  3. Trip to London
  4. Reading Habit
  5. Victory in Volleyball Tournament

Firstly, it's the first year, the idea of new year resolution come into reality when I defined and focus on the crusade of 'Helping 1 million people in my life'. It's a very strong principle that I carry with me the whole year and I can see a very significant change in my personal behavior when dealing with people and events that are around me. It will be a continuous principle and practice for the years to come.

The year of 2006 is also a year that display a 'jump' in my career. I am accepted and employed in a well-known MNC IT Service Center. It's a challenging yet exciting to pick up the new role, especially to understand and be familiar with processes in executing the tasks and accomplishing the mission. A paradigm shift in managing the tasks has occured as I am required to see things in bigger picture as an analyst, be proactive and initiative.

One of the greatest moment of the year was the company trip to London. I was sent to support the User Acceptance Test for an application that measures productivity of the employee. The sharing of feeling from the pickup of limosine from my house to KLIA Airport, boarding a Boeing 747 on a business class, transiting at Amsterdam till the visits to many many tourist spots in London and Greenwich will take up to hours. It will be a life-long memorable moments. In fact, I just read the news about Air Asia may offer flight to London at a more budgeted rate next year. That motivates me to fulfill my dream to be back to London again!

Compared to the past 3 years of working life, 2006 is the year in which I read the most, including listening to a lot of audio books. Among these are a few best sellers, including the one by Anthony Robbins, Jim Rohns, David Canfield, Zig Ziglar...etc. In particularly, I like the video called 'The Secret', the book 'The Success Principle by David Canfield. I sincerely encourages you to read up some of these. It may change your life forever.

Lastly, another great event experienced this year is the achievement in volleyball tournament. I was selected to be one of the player for our company's volleyball team to take part in a tournament, in which many other MNC companies in Cyberjaya also took part. Our team has the best combinations of talented and experienced players, which lead us to beat the other teams and emerge as champion. I am really proud of ourselves!

Looking back at these for the year of 2006, there will be some other big plans coming up for the year of 2007.

I would like to take this opportunity to wish you all the best for the coming year. Happy New Year of 2007!


Posted by T-rex Lim Huat Heng

Read this to yourself every morning and evening (before you go to sleep)


Mission Impossible 『不可能的事』

Posted by T-rex Lim Huat Heng

I would like to share something my friend from Taiwan shared with me. It's meaningful and please bear with me because it's in mandarin language.

Mission Impossible 『不可能的事』 世界上的事情非常奇怪~越是人們認為不可能的!做起來越有機會成功!第一位發現這個道理的據說是哥倫布

1485年5月~哥倫布到西班牙去遊說:『我從這兒向西走也能到達東方~只要你們拿出錢來資助我』~當時!沒有一個人阻止他~也沒有刺殺他~因為當時的人認為~從西班牙向西航行~不出500海哩~就會掉進無盡的深淵~想到達富庶的東方?那是決對不可能的! 可是~在他第一次航行成功~第二次又要去的時候~不僅遇到了空前的阻力~而且還有人在大西洋上攔截~並企圖暗殺他!至於原因~非常明確~因為沿這條航線絕對能夠到達富庶的東方~他再去一回~那兒的黃金!瑪瑙!翡翠!玉石!皮毛!香料!就會使得他富比王侯!不可一世! 越是人們認為不可能的!做起來越順暢!這一道理~在哥倫布死後救被人遺忘了!直至大約500年後~在華爾街上~才被一位叫巴菲特的美國人發現!





Another great quote from John Maxwell :
Everyone has the power to impact the outcome of his life. The way to do it s to focus on today... Today is the only time you have. It's too late for yesterday. And you can't depend on tomorrow.