Monday, April 18, 2011

Running PHP on GAE

Steps to run Quercus (Java-based PHP interpreter) on Google App Engine:

  1. Download Resin-4.x.x from http://caucho.com/download
  2. Copy lib/resin.jar to your WEB-INF/lib 
  3. Add com.caucho.quercus.servlet.GoogleQuercusServlet as a standard servlet in your web.xml
  4. Add index.php pages to your web-app

Reference:
http://blog.herbert.groot.jebbink.nl/2009/05/using-php-on-gae.html
http://wiki.caucho.com/Quercus_Google_App_Engine

Friday, April 15, 2011

JDO, JPA and Hibernate

1. JDO and JPA are specifications. They specify an interface to abstract the database technologies.

2. Hibernate is an implementation of JPA.

3. DataNucleus is an implementation of both JPA and JDO.

Java Data Objects (JDO) is a standard interface for storing objects containing data into a database. The standard defines interfaces for annotating Java objects, retrieving objects with queries, and interacting with a database using transactions. An application that uses the JDO interface can work with different kinds of databases without using any database-specific code, including relational databases, hierarchical databases, and object databases. As with other interface standards, JDO simplifies porting your application between different storage solutions.


Java Persistence API (JPA) is a standard interface for storing objects containing data into a relational database. The standard defines interfaces for annotating Java objects, retrieving objects using queries, and interacting with a database using transactions. An application that uses the JPA interface can work with different databases without using any vendor-specific database code. JPA simplifies porting your application between different database vendors.


Reference:
http://code.google.com/intl/eclipse/appengine/docs/java/datastore/jdo/overview.html


Wednesday, April 6, 2011

Running Linux Process in Background After Logout

You may know to append an ampersand to a shell command so as to run a process in background. For example,

> java myprogram &

This command runs the Java program in background. However, the process will be halted when you log out the session. To overcome this, you can make use of the 'screen' command.

screen                  # start a virtual session which keeps itself alive even you log out
Ctrl-A + ?             # show help
Ctrl-A + d             # detach from the screen
screen -r              # re-attach to the previous screen

Reference here: http://jmcpherson.org/screen.html

Friday, April 1, 2011

Firefox Addon: User Agent Switcher

If you are using the User Agent Switcher add-on with Firefox, and find it pesky to reset the user agent every time when the browser restarts, here is a trick:

1. Open the configuration tab in your FF by typing "about:config" in the URL bar.
2. Add the following attribute and value.
useragentswitcher.reset.onclose = false
3. Done!