Anything that interests me finds place here. Software dominates my interests and hence a good part of this blog as well.
Monday, December 28, 2009
Finish each day and be done with it.
- Ralph Waldo Emerson through Julie911
When we are ... just not brave enough ...
— Ardis Whitman through Julie911
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
- The employer’s contribution. You don’t have to contribute to your entire medical insurance premium.
- 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
A christmas carol
Monday, December 21, 2009
Basic Hibernate Command line application
To build the application, run
mvn clean install
To execute, run
mvn exec:java -Dexec.mainClass=tutorial.EventManager -Dexec.args="store"
Friday, December 18, 2009
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();
}
}
}
Tuesday, December 08, 2009
If you are greedy and lazy
If you are greedy and lazy you expect more result from less effort.
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.
Thursday, December 03, 2009
He who has a why to live for, can bear almost any how.
“He who has a why to live for, can bear almost any how.”
- Friedrich Nietzsche through Julie911
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:
- View (represented by PortletMode.VIEW) – usually portlets represent their current state
- Edit (PortletMode.EDIT) – Options to edit data are presented here
- 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
- Init
- Process Action
- Render
- 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
- 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
- Process Action & Render - Requests raised by portlets can from
- 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.
- Render URL: request only fires render() method on all the portlets.
- 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,
- Read from the bottom of the trace
- Read the Message of the last stack trace (usually there are many with “caused by”)
- 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.