Saturday, December 5, 2009

SELF-HELP: Being Right Isn't Most Important Thing when it Comes to Your Significant Other

by James Kent

Many couples get into heated arguments with the only real purpose on being right, this is really the wrong approach. Remember that arguments are not really an effective communication method, but more two people making their point. The major purpose should be to maintain the harmony in the relationship rather than being right. In the heat of an argument its highly unlikely that the other person will be receptive to your point of view. Some research has even shown that when the heart is beating 100 times or more the other person will be physically unable to hear you. In my opinion the only real ways to end an argument on good terms are walk away, let down your viewpoint or find a way to change the argument into a calm discussion.

Walking away will not initially be a popular decision by the other party, but stick to your guns and remember someone can only argue by themselves for so long. Letting go of your viewpoint is another excellent piece of advice its highly unlikely that your get the other person to see your point of view in the heat of an argument. If you are prepared to let go of your point of view it is likely that the argument will end. The final option is both the most effective and the hardest to achieve. The best way to attempt this without conceding your viewpoint is to use repair attempts. Make the other person aware that you understand their concerns and assure them we will discuss this when we are both calm. Another option is to turn away from anger and towards love, use affection and say something like “we do not need to do this now, just come and hug me”.

Friday, November 6, 2009

JAVA: Retrieving List of Blog Posts Using Blogger Data API

You can use the Java Blogger Data API to display the list of blog entries.

First you need to download the Java client library. You'll find the classes you need to use in the java/lib/gdata-core-1.0.jar file.

GData Java Client Library has the following external dependencies which you also need to add
1. java/deps/google-collect-1.0-rc1.jar
2. java/deps/jsr305.jar

Finally, add the following sample code to display the list of blog entries.
import java.util.LinkedList;


public class Blogger {
public static void main(String[] args)
String username = "";
String userpass = "#";
String feed ="";

URL feedUrl = new URL(feed);
GoogleService myService = new GoogleService("blogger", "bprddd");

//Set up authentication (optional for beta Blogger, required for current Blogger):
myService.setUserCredentials(username, userpass);

//Send the request and receive the response:
Feed myFeed = myService.getFeed(feedUrl, Feed.class);

LinkedList<Entry> entries = (LinkedList<Entry>)myFeed.getEntries();
int itemsPerPage = myFeed.getItemsPerPage();

Entry entry ;
for(int i=0; i < itemsPerPage; i++){
entry = (Entry)entries.get(i);
TextContent tc = (TextContent)entry.getContent();
HtmlTextConstruct ptc = (HtmlTextConstruct)tc.getContent();
catch (AuthenticationException e) {
}catch (ServiceException e) {
}catch (IOException e) {

Wednesday, October 28, 2009

JAVA: Struts 2 on Google App Engine

1. Eclipse IDE ver. 3.5
2. Googe App Engine Java SDK 1.2.5 and Google Plugin for Eclipse
2. Latest Release of Struts2 framework (note: used the the release)


1. Create a new Web Application Project in Eclipse.
1.1. Go to File-New-Web Application Project
1.2. Enter the Project name and Package. Uncheck the "Use Google Web Toolkit".

2. Add the following Struts2 libraries to /WEB-INF/lib/. Also, add these libraries to Java Build path (Right click "Project Name"->"Build Path"->"Configure Build Path...". Go to "Libraries" tab and click "Add JARS.. button to add the needed libraries).


3. Modify the auto-generated appengine-web.xml (to enable the sessions and ssl).

<appengine-web-app xmlns="">

<!-- Configure java.util.logging -->
<property name="java.util.logging.config.file" value="WEB-INF/">



4. Modify the web.xml.

<web-app xsi=""
schemalocation="" version="2.5">





5. Set the OgnlRuntime Security Manager.
Note that if you run the application after doing procedure 4, you will get OgnlException. To resolve this , implement an ServletContextListener which will set OGNL security manager to null when the context is initialized.

package net.gae.struts2den.common;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import ognl.OgnlRuntime;

public class InitListener implements ServletContextListener,
HttpSessionListener, HttpSessionAttributeListener {

public void contextInitialized(ServletContextEvent sce) {

public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub


public void sessionCreated(HttpSessionEvent arg0) {
// TODO Auto-generated method stub


public void sessionDestroyed(HttpSessionEvent arg0) {
// TODO Auto-generated method stub


public void attributeAdded(HttpSessionBindingEvent arg0) {
// TODO Auto-generated method stub


public void attributeRemoved(HttpSessionBindingEvent arg0) {
// TODO Auto-generated method stub


public void attributeReplaced(HttpSessionBindingEvent arg0) {
// TODO Auto-generated method stub



Note: in web.xml (of procedure 4 ), an entry for InitListener is already implemented as


6. Create struts.xml in src folder


<constant name="struts.ui.theme" value="simple">

<package name="helloworld" namespace="/helloworld" extends="struts-default">
<result name="failed">/WEB-INF/jsp/myapp1/failed.jsp

<!-- http://localhost:8080/helloworld/HelloWorld.action -->
<action name="HelloWorld" class="net.gae.struts2den.action.HelloWorld">


7. Create the HelloWorld action (net/gae/struts2den/action/

package net.gae.struts2den.action;
import com.opensymphony.xwork2.ActionSupport;

public class HelloWorld extends ActionSupport {

public static final String MESSAGE = "Struts is up and running ...";

public String execute() throws Exception {
return SUCCESS;

private String message;

public void setMessage(String message){
this.message = message;

public String getMessage() {
return message;

8. Create the helloworld.jsp (WEB-INF/jsp/helloworld.jsp)

<h2><s:property value="message"></s:property></h2>

9. Run the application and open http://localhost:8080/helloworld/HelloWorld.action and see what happens!

sample application at: