Wednesday, February 10, 2010

Power of self

When our thinking is based on our objects in our experience, “we are constantly seeking the approval of others. Our thinking and behavior are always in anticipation of a response. It is therefore fear-based.” There is also a “need control things. The need for approval, the need to control things, and the need for external power are needs that are based on fear. This kind of power is not the power of pure potentiality or power of the self, or real power.” …”Power based on object referral …lasts only as long as the object of reference is there. If you have a certain (job) title or if you have a lot of money the power you enjoy goes with “ the title or money. “Ego based power will last only last as long as those things last. As soon as the title, the job, the money go away, so does the power”.

 

The true self, “which is your spirit, your soul, is completely free from those things. It is immune to criticism, it is unfearful of any challenge, and it feels beneath no one. And yet, it is also humble and feels superior to no one, because it recognizes that everyone else is the same self, the same spirit in different disguise.” .. “It draws people to you and it also draws things that you want to you.”…”It is the support of divinity; it is the support that comes from being in the state of grace. Your power is such that you enjoy a bond with people and people enjoy a bond with you”..”A bonding that comes from true love”.

 

-          “The Seven Spiritual Laws of Success” by Deepak Chopra with my words (not quoted)

Monday, February 08, 2010

There is my queen and what a privilege it has been to love her.

“True love. You know … when you’re old and you’re wrinkly and you’re sitting there gumming your food and your husband looks at you and even though he doesn’t see you very well anymore, he can see in your eyes the whole world: the future, the past, everything that was good and even things that were bad, and he can still say, ‘There is my queen and what a privilege it has been to love her.’”

- Prince Charming through Julie911

Don't be careless, but don't be too careful either.

“It’s easy to be confident when you have control of the puck. It’s very difficult to keep that confidence when you have to take whatever strange bounces life throws your way. Don’t be careless, but don’t be too careful either. You cannot be afraid to lose.”

- Jeffrey Nordling through
Julie911

School vs. Life

“The difference between school and life? In school, you’re taught a lesson and then given a test. In life, you’re given a test that teaches you a lesson.”

- Tom Bodett through Julie911

Time is tricky

“Time is tricky. You have whole months, even years, when nothing changes a speck, when you don’t go anywhere or do anything or think one new thought. And then you can get hit with a day or an hour, or half a second, when so much happens its almost like you are born all over again into some brand-new person you for damn sure never expected to meet.”

- Life is Funny through Julie911

You know we just don't recognize the most significant moments of our lives while they're happening. Back then I thought, well, there'll be other days. I didn't realize that that was the only day.

“You know we just don’t recognize the most significant moments of our lives while they’re happening. Back then I thought, well, there’ll be other days. I didn’t realize that that was the only day.”

- Field of Dreams through Julie911

Sunday, February 07, 2010

The right collaboration

Classes collaborate with each other to deliver their responsibility. In doing so, classes must make the least assumptions about the other classes. Too few assumptions, the collaboration will not be useful. Too many assumptions, the collaboration becomes a pack of cards (changes on one class will break the other class). More collaboration assumptions made is more coupling.

Interfaces help a given class to explicitly specify the assumptions that the clients can safely make when collaborating with that class. This set of assumptions must be balanced to be useful enough but not too detailed.

For example consider a StudentController class (a application UI class) that collaborates with JDBCStudentDAO class.

Class StudentController
{
JDBCStudentDAO dao = new JDBCStudentDAO();
public Student saveStudentUIAction(Student student)
{
return dao.jdbcSave(student);
}
}

In this case, StudentController makes assumptions about the implementation details of JDBCStudentDAO and public methods exposed by the implementation. This has the following disadvantages:
1. Any change in JDBCStundetDAO that violates any assumption made by StudentController will break StudentController.
2. Consider a HibernateStudentDAO which does *not* have the same public methods as JDBCStudentDAO (say HibernateStudentDAO only has a hibernateSave(Student) method and not a jdbcSave(Student)). Then replacing JDBCStudentDAO with HibernateStudentDAO will
a. Take more time to change StundentController
b. Cause more regression (every implementation assumption made by StudentController on JDBCStudentController that is violated by HibernateStundentController will lead to regression)

The solution: let StudentController reference a StudentDAO (an interface that explicitly states the assumptions that clients like StudentController can make). So we have

class StudentController
{
StudentDAO dao = new JDBCStudentDAO();
public Student saveStudentUIAction(Student student)
{
return dao.save(student); // Implemented by JDBCStudentDAO & HibernateStudentDAO
}
}

This solution solves ton of issues but not all of them. StudentController is still statically bound to JDBCStudentDAO.

To unit test StudentController let us suppose we write the following StudentControllerTest

class StudentControllerTest
{
public testSaveStudentUIAction()
{
Student student = new Student("Johnson");
Student savedStudent = studentController.saveStudentUIAction(student);
assertNotNull(savedStudent.getKey());
}
}

Let us assume that saveStudentUIAction can return null & throw a DuplicateStudentException. To simulate this scenario, JDBCStudentDAO must be exercised. But that is a test appropriate to JDBCStudentDAOTest, *not* StudentControllerTest. In short, StudentControllerTest must exercise and test only StudentController and not the classes that StudentController is dependent on. To achieve this, StudentController should be made to interface with a stub implementation of StudentDAO in the test cases and an actual implementation (like JDBCStudentDAO or HibernateStudentDAO) in the application. So StudentController should must not instantiate JDBCStudentController. But a implementation of StudentDAO must be handed over to it. This handing over of StudentDAO implementation can be achieved through Spring IOC (Inversion of control) or dependency injection.

So we now have

class StudentController
{
StudentDAO dao;
public Student saveStudentUIAction(Student student)
{
return dao.save(student); // Implemented by JDBCStudentDAO & HibernateStudentDAO
}
// This setter is invoked by spring IOC with stub implementation (that
// does what the test case wants to exercise) in test cases and
// actual implementation in the application
public void setDao(StudentDAO studentDAO)
{
dao = studentDAO;
}
public void getDao()
{
return dao;
}
}

Sunday, January 31, 2010

Basic Spring application

Here is a very basic spring application. This can be used to play around with various spring features.

This moment in the future

In the future you should be able to look at this moment and say to yourself that you couldn't have spent it better.

- Nithya (my wife)

Saturday, January 30, 2010

Fear is not what’s important, it’s how you deal with it.

“Fear is not what’s important, it’s how you deal with it. It would be like asking a marathon runner if they feel pain. It’s not a matter of whether you feel it, it’s how you manage it.”

- James Nachtwey - War Photographer (2001) through Julie911

...You’re not the first person who was ever confused and frightened and even sickened by human behavior

“Among other things, you’ll find that you’re not the first person who was ever confused and frightened and even sickened by human behavior. You’re by no means alone on that score, you’ll be excited and stimulated to know. Many, many men have been just as troubled morally and spiritually as you are right now. Happily, some of them kept records of their troubles. You’ll learn from them”

- J.D. Salinger, The Catcher in the Rye, Chapter 24 through Julie911

Thursday, January 28, 2010

Indexing tip

Searching by more than one column (i.e. more than one predicate in the where clause) is a very common scenario. To fasten such queries, creating indices is a common practice. The question: How to reuse the same index for both single column and multi column searches? For example, consider a student table with id, first_name and last_name columns. If the DB receives numerous queries with first_name and last_name in there where clause, then what should the indexing strategy be?

 

To elaborate on the question, the indexing strategy needs to support the following queries

 

Select * from student where first_name like ‘blah%’; -- Scenario 1

Select * from student where last_name like ‘blah%’; -- Scenario 2

Select * from student where first_name like ‘blah%’ and last_name like ‘blah%’; -- Scenario 3

 

One possible solution is to create 3 indices for the 3 scenarios (one for first_name, one for last_name and one for first_name and last_name). This is not so interesting.

 

The other alternative leverages on the fact that a query based on first_name only will also use an multi-column index (index on more than one column) provided first_name is the first column in the multi-column index.

 

So in the above scenario, the following indices need to be created:

 

CREATE INDEX idx_student_firstName_last_name ON student (first_name, last_name); -- takes care of first_name only (scenario 1) and first_name and last_name queries (scenario 3)

CREATE INDEX idx_student_last_name ON student(last_name); -- takes care of last_name queries (scenario 2)

Attributes of pure consciousness

Attributes of pure consciousness are pure knowledge, infinite silence, perfect balance, invincibility, simplicity and bliss.

 

-          Deepak Chopra in “The Seven Spiritual Laws Of Success

Wednesday, January 27, 2010

Never let negative feelings block the path to your goal

“One of the first principles of applied mindism is to never let negative feelings block the path to your goal. Otherwise you are always sinking back into discouragement.”

- Jack Nicholson through Julie911

The world will freely offer itself to you to be unmasked....it will roll in ecstasy at your feet

“You need not even leave your room. Remain sitting at your table and listen. You need not even listen simply wait. You need not even wait, just learn to become quiet and still, and solitary. The world will freely offer itself to you to be unmasked. It has not choice; it will roll in ecstasy at your feet”

 

-          Franz Kafka from “The Seven Spiritual Laws Of Success” by Deepak Chopra

Friday, January 22, 2010

The best portion of a good man’s life is....

"The best portion of a good man's life is the little, nameless, unremembered acts of kindness and love."

- William Wordsworth through Julie911

Failure Atomic

When a method invocation on an object fails, the object should revert back to the state that it was in prior to the invocation. If it does this, then the method is failure atomic.

Coining user messages in a failure scenario

When an operation (such as save) is triggered from an UI application, the call trickles down to underling APIs. If something wrong happens with the operation, then the user needs to be notified of the failure on the UI. The question: how and where should this UI message be coined?

 

Consider the following (over simplified) code to achieve a save operation

 

// 1. UI code calls setNewStudent(Student) with the student data entered in UI form (xhtml, JSP, etc…)

 

// 2. An action on the UI (button click for example) invoked the following method

StudentUIController.saveNewStudent()

{

    StudentDAO.SaveOfUpdate(getNewStudent()); // 3. UI Code makes DAO layer call to persist object

}

 

StudentDAO.saveOrUpdate( Student )  // 3.

{

    // Persist the student

}

 

One of the best practices to handle the failure scenario is to have the DAO layer (StudentDAO in this example) throw a custom exception. The UI layer (StudentUIController) must catch this exception and coin a message for the user. The custom exception should have enough information in it for the UI layer to coin a meaningful message for the user from the exception. In some cases, the DAO layer may also give a brief message of what went wrong in the exception.

 

Will update this post soon with the code after I have a working example of how this is to work.

 

Wednesday, January 20, 2010

"Don't be afraid to give your best to what seemingly are small jobs. Every time you conquer one it makes you that much stronger. If you do the little jobs well, the big ones will tend to take care of themselves."

“Don’t be afraid to give your best to what seemingly are small jobs. Every time you conquer one it makes you that much stronger. If you do the little jobs well, the big ones will tend to take care of themselves.”

- Dale Carnegie through Julie911

Tuesday, January 19, 2010

Remember no man is a failure who has friends.

"
Dear George,

Remember no man is a failure who has friends.

Thanks for the wings!

Love,
Clarence"

- Its a wonderful life

Ideals without common sense can ruin this town

Ideals without common sense can ruin this town - it's a wonderful life

Monday, January 18, 2010

Creating an index on a column using hibernate mapping

Mapping:

 

<property

  name="name"

  column="student_name"

  type="string"

  index="xyz__student_name"/>

 

Table Structure (in PostgreSQL)

 

CREATE TABLE xyz

(

  id bigint NOT NULL,

  student_name character varying(255),

  CONSTRAINT xyz_pkey PRIMARY KEY (id)

)

 

CREATE INDEX xyz__student_name

  ON xyz

  USING btree

  (student_name);

Creating a unique contraint on a column through hibernate mapping

Mapping:

 

<class …>

  <natural-id>

    <property

      name="name"

      column="name"

      type="string" />

  </natural-id>

</class>

 

Table Structure (in PostgreSQL):

 

CREATE TABLE xyz

(

  id bigint NOT NULL,

  "name" character varying(255) NOT NULL,

  CONSTRAINT xyz_pkey PRIMARY KEY (id),

  CONSTRAINT xyz_name_ukey UNIQUE (name)

)

 

Friday, January 15, 2010

may God turn their ...ankles, so that we may know them by their limping :-)

“May those who love us, love us. And those who don’t love us, may God turn their hearts. And if He cannot turn their hearts, may He turn their ankles, so that we may know them by their limping.”

- Keeping The Faith / Irish Prayer through Julie911

Wednesday, January 06, 2010

Don't be afraid

“Don’t be afraid. Don’t be daunted. Just do your job. Continue to show up for your piece of it, whatever that might be. If your job is to dance, do your dance. If the divine cock-eyed genius assigned to your case decides to let some sort of wonderment be glimpsed for just one moment, through your efforts, then olĂ©! And if not, do your dance anyhow, and olĂ© to you nonetheless.”

- 
Elizabeth Gilbert through Julie911

Monday, December 28, 2009

Finish each day and be done with it.

“Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense.”

- Ralph Waldo Emerson through Julie911

When we are ... just not brave enough ...

"There are times when it is hard to believe in the future, when we are temporarily just not brave enough. When this happens, concentrate on the present. Cultivate le petit bonheur (the little happiness) until courage returns. Look forward to the beauty of the next moment, the next hour, the promise of a good meal, sleep, a book, a movie, the likelihood that tonight the stars will shine and tomorrow the sun will shine. Sink roots into the present until the strength grows to think about tomorrow."
— Ardis Whitman through Julie911

I see who I wanna be in my daughter’s eyes

“In my daughter’s eyes I am a hero. I am strong and wise and I know no fear, but the truth is plain to see: she was sent to rescue me. I see who I wanna be in my daughter’s eyes.”

- Martina McBride through Julie911

Wednesday, December 23, 2009

Basic Hibernate APIs

      // configure will look for mapping & settings in an application     

      // resource file named hibernate.cfg.xml

      SessionFactory sessionFactory =

            new Configuration().configure().buildSessionFactory();

      Session session = sessionFactory.getCurrentSession();

      try

      {

            session.beginTransaction();

           

            Event testEvent = new Event();

            testEvent.setTitle("testTitle");

           

            session.save(testEvent);

            // Commit if all goes well

            session.getTransaction().commit();

      }

      catch (Exception e )

      {

            // rollback if something fails

            session.getTransaction().rollback();

      }

 

Advantages of group insurance provided by employer in U.S

  1. The employer’s contribution. You don’t have to contribute to your entire medical insurance premium.
  2. No pre-existing conditions. If one approaches the insurance company directly, any pre-existing conditions are not covered. But this does not apply for group medical insurance provided by employer.

- As I understand from a friend of mine.

Tuesday, December 22, 2009

Seriousness ...can't be over done

I consider seriousness to be a admirable change of character, but it can't be over done.
A christmas carol

Monday, December 21, 2009

Basic Hibernate Command line application

Here is a basic hibernate command line application that is based on the getting started chapter of Hibernate Reference Documentation. It works with PostgreSQL and can be used to play around with small code changes and seeing the impact on the database. To point to another database, change hibernate.cfg.xml.


To build the application, run

mvn clean install

To execute, run

mvn exec:java -Dexec.mainClass=tutorial.EventManager -Dexec.args="store"

Wednesday, December 16, 2009

Whether your kid is a concert pianist or a math genius, it just doesn't matter, because at the end of the day all that matters is...

“Some day you’re gonna have a baby and you’re gonna feel overwhelmed by this little life that you’re responsible for and you’re gonna think and worry that everything you do is wrong, and that’s normal. You’re gonna obsess about what to feed it, and where to send it to school, and whether it should take violin or piano. But, I’m gonna let you in on a little old secret, it doesn’t matter. Whether your kid is a concert pianist or a math genius, it just doesn’t matter, because at the end of the day all that matters is if your kid is happy.”

- 
Grey’s Anatomy through Julie911

Believe that there's light at the end of the tunnel. Believe that you might be that light for someone else.

“Believe that there’s light at the end of the tunnel. Believe that you might be that light for someone else.”

- 
Kobi Yamada through Julie911

Tuesday, December 15, 2009

Merging specific changes from trunk to branch

To merge a set of specific revisions from the trunk to branch [this is usually required when a code change on trunk after a release needs to be back ported on to the release (each release having its tag)].

 

# cd abc/tags/1_7_3 # go to the branch

# svn merge svn://xyz/abc/trunk@8108 svn://xyz/abc/trunk@8109 . # merge into current working copy (branch)

Monday, December 14, 2009

Free Mind - mind mapping tool looks good

A couple of my colleagues discussed this:

 

http://freemind.sourceforge.net

Friday, December 11, 2009

Pursuit of greatness

Pursue something from nothing,

Pursue something good from something,

Pursue greatness from something good.

anybody driving slower than you is an idiot, and anyone going faster than you is a maniac

“Have you ever noticed that anybody driving slower than you is an idiot, and anyone going faster than you is a maniac?”

- 
George Carlin through Julie911

Thursday, December 10, 2009

To be present in the appreciation of life's abundance

Gratitude: To be present in the appreciation of life’s abundance and to share that light with others.

by Donna Downey through Julie911

Wednesday, December 09, 2009

Debugging exceptions with no known cause

There are times when you call a third party method in your code which throws an exception. Your line that invokes the third party code is not seen in the exception stack trace. In these cases, it is useful to wrap the call to the third party code in try catch block, catch Exception and log the resulting exception. The stack trace from the exception you log will have your code that is making the third party call, calls made by the third party code and likely a more detailed message of what went wrong.

 

e.g.:

 

class MyClass

{

    public void myMethod()

    {

        try

        {

            new ThirdPartyClass().thirdPartyMethod();

        }

        catch (Exception e)

        {

            e.printStackTrace();

        }

    }

}

Usually an application will create a single Configuration, build a single instance of SessionFactory and then instantiate Sessions in threads servicing client requests.

 

Monday, December 07, 2009

Now becomes my past...so let me handle it mindfully

What is now will become the past in the future. If you don’t want to feel sorry in the future….act mindfully now.

Cold Weather coming in

Thursday, December 03, 2009

Wednesday, December 02, 2009

Portlet Modes

The mode indicates the function that the portlet is currently performing. A portlet’s current mode is passed to it by the portlet container. Based on the mode, the portlet can choose to generate different contents. In processAction() method, the portlet can change the mode programmatically.

 

Portlets can be in 3 modes:

  1. View (represented by PortletMode.VIEW) – usually portlets represent their current state
  2. Edit (PortletMode.EDIT) – Options to edit data are presented here
  3. Help (PortletMode.HELP) – Generic or context sensitive information about the portlet provided here.

 

The portlet modes that a user has access to can be restricted by his authentication credentials (e.g. guest can only read and access help).

 

Custom portlet modes are also supported. These custom modes can be portal managed (portal will manage custom modes for the portlet) or portlet managed (portlet manages its mode in its own code. Portal not aware of portlet’s modes).

 

In portlet.xml, the modes that the portlet supports are indicated as follows:

 

<portlet>

  …

  <supports>

    <mime-type>text/html</mime-type>

    <portlet-mode>view</portlet-mode>

    <portlet-mode>edit</portlet-mode>

    <portler-mode>help</portlet-mode>

  </supports>

</portlet>

 

Initialization parameters to a portlet can be specified as follows in portlet.xml:

 

<portlet>

  <init-param>

    <name>view-action</name>

    <value>test</value>

  </init-param>

  <init-param>

    <name>edit-action</name>

    <value>test2</value>

  </init-param>

  …

</portlet>

 

These initialization parameters can be accessed in the portlet using the PortletConfig.

      

Portlet lifecycle

The portal, during the course of managing a portlet, passes the portlet through the following stages

  1. Init
  2. Process Action
  3. Render
  4. Destroy

There is one method in the Portlet interface for these stages. Right before a stage change occurs (e.g. when the portal is about to destroy a portlet), the portal notifies the portlet by invoking the appropriate method (the destroy() method for e.g.) on the Portlet Interface.

 

These are the possible state transitions

Init -> Process Action <-> Render -> Destroy

 

  1. Init – Porlet is loaded and instantiated either on portlet container start or upon receipt of request for the portlet. Following this, the init() method on the portlet will be invoked. Portlets usually initialize expensive resources (connections for e.g.) at this time
  2. Process Action & Render - Requests raised by portlets can from
    1. Action URL: request fires processAction() method on portlet on which the URL resides and render() method on all the portlets. The portlet, in its processAction() method, updates its model. The render() method generates a view that indicates the current state of the model.
    2. Render URL: request only fires render() method on all the portlets.
  3. Destroy – Portal’s notice that the portlet is to be removed. Typically, a portlet will release all resources and persist any yet-to-be-persisted state/model.

 

Tuesday, December 01, 2009

When ... you could not hold on a minute longer, never give up then, for that is just the place and time that the tide will turn.

“When you get into a tight place and everything goes against you, till it seems as though you could not hold on a minute longer, never give up then, for that is just the place and time that the tide will turn.”

- 
Harriet Beecher Stowe through Julie911

Looking at java stack traces

While looking at stack traces,

  1. Read from the bottom of the trace
  2. Read the Message of the last stack trace (usually there are many with “caused by”)
  3. Look for a line in the stack trace that indicate a call to your package in the stack trace. This way, you will know how your code is getting called and what your code is doing.

Monday, November 30, 2009

let us all be thankful.

“Let us rise up and be thankful, for if we didn’t learn a lot today, at least we learned a little, and if we didn’t learn a little, at least we didn’t get sick, and if we got sick, at least we didn’t die; so, let us all be thankful.”

- Buddha Through Julie911

Tragedy is a test of courage.

 “Tragedy is a test of courage. If you can meet it bravely, it will leave you bigger than it found you.”

- A Star is Born (1937) from Perfectly Imperfect/Julie911

 

 

The joy of life comes from our encounters with new experiences

 “So many people live within unhappy circumstances and yet will not take the initiative to change their situation because they are conditioned to a life of security, conformity, and conservatism, all of which may appear to give one peace of mind, but in reality nothing is more dangerous to the adventurous spirit within a man than a secure future. The very basic core of a man’s living spirit is his passion for adventure. The joy of life comes from our encounters with new experiences, and hence there is no greater joy than to have an endlessly changing horizon, for each day to have a new and different sun.”

- Chris McCandless, Into The Wild from Perfectly Imperfect/Julie911

 

 

Wednesday, November 25, 2009

You should never try to be better than someone else

You should never try to be better than someone else. Always learn from others. Never sease trying to be the best that you could be. That is under your control. If you are too engrossed into things that you have no control, it will adversely affect the things over which you have control.

Definition of success: Peace of mind attending only through self satisfaction in knowing you made the best of the effort of which you are capable of. Others cannot judge it. Your reputation is what you are perceived to be. Your character is what you really are.

Believe that the ways will work out the way we want it to provided we do what we should.


Sometimes I think the Fates must grin as we denounce them and insist the only reason we can't win, is the Fates themselves that miss.
Yet there lives on the ancient claim:
We win or lose within ourselves. The shining trophies on our shelves can never win tomorrow's game.
You and I know deeper down, there's always a chance to win the crown,
But when we fail to give our best,
we simply haven't met the test, of giving all
and saving none until the game is really won.
Of showing what is meant by grit.
Of playing through when other Quit,
Of playing though, not letting up.
It's beating down that wins the cup. Of dreaming there's a goal ahead.
Of hoping when our dream are dead.
Of praying when our hopes are fled.
Yet losing, not afraid to fall,
if bravely we have given all. For who can ask more of a man
then giving all within his span.
Giving all, it seems to me, is not so far from vistory.
And so the fates are seldom wrong, no matter how they twist and wind,
It's you and I who make our fates.
We open up or close the gates on the road ahead or the road behind.



Never mention Winning. You can lose when you outscore somebody in a game. And you can win when you're outscored.
Hold your head up after a game. When a game is over, and you see somebody that didn't know the outcome, I hope they cound't tell by your actions whether you outscored an opponent or the opponent outscored you.

If you make the effort to do the best you can regularly, the results will be about what they should be. Not necessary to be what you want them to be, but they will be about what they should.

The result of the game should be the byproduct of your best effort and not the end result.

"The journey is better than the end" - Cervantes


- My notes from a talk by John Wooden (source)

The reason people find it so hard to be happy is ...

“The reason people find it so hard to be happy is that they always see the past better than it was, the present worse than it is, and the future less resolved than it will be.”

- 
Marcel Pagnol Through Julie911

Monday, November 23, 2009

...This, too, shall pass.

“Expect trouble as an inevitable part of life and repeat to yourself the most comforting words of all: This, too, shall pass.”

- Ann Landers Through Julie911

Sunday, November 22, 2009

Strategies for development with Liferay

Following options can be adopted for developing Liferay based solutions
1. Plug-in SDK Environment (least [but sufficient in most cases,] flexibility and least migration effort): Liferay supports different types of plugins such as themes, layout templates, portlets, webs (which are web applications) and hooks. Liferay provides a Plug-in SDK to facilitate development of these plugins. One can extend by implementing the appropriate plug-in.
2. Extension Environment (Very good flexibility and can need extensive migration effort): This approach involves writing custom code that overrides Liferay code. Following approaches to overriding liferay code exist:
a. Modifying JSP files (of the porttal or the built in portlets)
b. Modifying configuration files (portal-ext.properties [layouts, themes, hibernate, cache, users, groups ets...], system-ext.properties [for java system properties used by liferay], ext-spring.xml [custom source code being spring dependency injected], web.xml [for servlet configuration], struts-config.xml [for struts related extension]
c. Custom classes (configures through portal.properties)
This approach does *not* include changing Liferay source code.
3. Modifying Liferay Source code: Pay Liferay, get their source code changed and contributed back to community.

Portlets in Liferay

There are 3 approaches to building portlets that can be deployed in liferay
1. JSR 168/286 Compliant Portlet - This is a standards compliant portlet and can hence be deployed not only in Liferay but in any portal server. The downside is it cannot use Liferay specific APIs.
2. Liferay plugin portlet - These portlets are liferay plugins. They may have a dependency on Liferay APIs (Portal kernel and Portal Service). Having dependencies on Liferay APIs restricts their portability to Liferay only.
3. Web application exposed as a portlet - One type of a Liferay plugin is a web applications (webs). So a simple web application can be exposed as a portlet in Liferay using the webs plugin.

Saturday, November 21, 2009

DRM - Digital Rights Management

My limited understanding of DRM: When music is downloaded from itunes, it includes the user id as a (DRM) label into the content file. This way when the content file is published on a file sharing web site, the culprit is easily know.

Friday, November 20, 2009

Audio connectors/plug/jacks

Stereo plugs are TRS (Tip, Ring, Sleeve) connectors. The TRS indicate contact points where audio signals are passed on. There are just TS and TRRS connectors too.

Jack plug, in UK, refers to a female connector and an Jack socket to a make connector.

In US when a connector is fixed, its called a jack.

2.5mm (diameter) Male Stereo socket - not commonly used

3.5mm (diameter) Male Stereo socket - the most commonly used:
There is also a 6.3 mm which is also used but not as frequently as 3.5 mm.

An RCA (Radio Corporation of America - which found it ) Male socket




Thursday, November 19, 2009

Which process has a lock on a file (continued....)

The command line utility to check the processes that have a lock on a given file:

 

e.g.

 

$ handle server.log

 

Handle v3.42

Copyright (C) 1997-2008 Mark Russinovich

Sysinternals - www.sysinternals.com

 

<Non-existant Process> pid: 277144  43C: E:\xyz\abc\logs\server.log

<Non-existant Process> pid: 278500  71C: E:\xyz\abc\logs\server.log

<Non-existant Process> pid: 279112  71C: E:\xyz\abc\logs\server.log

$CDPATH - very useful for bash shell navigation

Often, we “cd” to commonly used directories in a bash shell. Having to type the whole path is often a pain. I was using aliases to navigate to commonly used directories (e.g. alias scripts=’cd /cygdrive/c/scripts’). But this would require you to identify each frequently used directory, define an alias for each one of them and remember the alias.

 

A good friend of mine, pointed out an alternate to achieve the same. $CDPATH. This is a set of paths that the “cd” command would look into (besides “.”) for the directory to switch to. So if “cd scripts” is executed, it will check if the current directory has a “scripts” directory, if not, it will look for a “scripts” directory in each directory indicated in the “CDPATH” variable. If “CDPATH” has “/cygdrive/c/: /cygdrive/c/home/xyz”, then cd will look for “./scripts”, “/cygdrive/c/scripts”, “/cygdrive/c/home/xyz/scripts” and cd to the first directory that exists.

 

Source.

 

Wednesday, November 18, 2009

Which process has a lock on a file

Many times one attempts to delete a file and windows reports that the file is in use by another program and hence cannot be deleted. Tracing out which program is using the file was a hassle.

 

With Windows Process Explorer, you can figure out which process is holding the lock on a given file.

 

Once installed and started, click on “Show Lower Pane (Ctrl + L)” on the tool bar. This will open up a listing below the list of the processes. Now click on a process and all files used by that process is listed in the lower pane.

Saturday, November 14, 2009

Friday, November 13, 2009

Merging specific commited changes from one branch to another

To merge changes made in revision 7877 from trunk to the current working directory (which could be another branch):

 

svn merge -r -r7876:7877 svn://xyz/abc/efg/trunk

Lunch at O'falafel today

Went to O’falafel today and the sandwich for pretty good.

Thursday, November 12, 2009

There is more to life than increasing its speed.

“There is more to life than increasing its speed.”

- 
Gandhi through Kari-shma

Tuesday, November 10, 2009

When you love someone...

“When you love someone, you’ve got to trust them. There’s no other way. You’ve got to give them the key to everything that’s yours. Otherwise, what’s the point?”

- 
Robert De Niro, Casino through Julie911

"A cheerful frame of mind, reinforced by relaxation. is the medicine that puts all ghosts of fear on the run."

“A cheerful frame of mind, reinforced by relaxation… is the medicine that puts all ghosts of fear on the run.”

- 
George Matthew Adams through Julie911

Friday, November 06, 2009

Tuesday, November 03, 2009

Stress is poison.

“Stress is poison.”

- Agavé Powers through Julie911