Skip to main content

Posts

Access multiple Databases in JPA

According to JPA specification we can define multiple "persistence-unit" elements (i.e. like below) in persistence.xml file and can easily refer them inside Dao layers as this. public class PolarDaoImpl {     @PersistenceContext(unitName="PolarPU")     protected EntityManager entityManager; -- } public class BearDaoImpl {     @PersistenceContext(unitName="BearPU")     protected EntityManager entityManager; -- } Checkout sample persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">     <!-- Database 1 -->     <persistence-unit name="PolarPU" transaction-type="RESOURCE_LOCAL">        ...

Two point formula for Apple IPhone to outsell Android ?

Introduce multiple Iphones with a basic one costing around $100 so Carriers can give it for free in US, and in rest of the world most people can afford it, this can be very slim like IPod without any camera and special hardware, so regular user can enjoy web and touch screen. Introduce and Advertise more Geeky themes which young men would like, this is where Android is making inroad. This is for free -- Do something about Java on IPhone like how Google cleverly used it. 

Running Liferay in Development Mode

Liferay speeds up rendering UI pages including Portlets by caching CSS, JS and layout files, this make developing portlets little painful, since every time you make js or css changes in your portlet and deploy. you may have to clear temp, work directoires and clear caches from Liferay control panel. So when using Liferay for development we can switch off the caching by adding few properties to "portal-ext.properties" file, this will save some time and frustation when developing portlets Solution 1 :  Copy all values from portal-developer.properties to portal-ext.properties Solution 2 :  Copy below values to portal-ext.properties, portal-ext.properties location - webapps/ROOT/WEB-INF/classes/portal-ext.properties if not present create a new one theme.css.fast.load=false theme.images.fast.load=false javascript.fast.load=true javascript.log.enabled=true layout.template.cache.enabled=false browser.launcher.url= combo.check.timestamp=true freemarker...

Easy access to Spring ApplicationContext in any non bean class

Checkout the following class import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; /**  *  * @author intesar  * Simple bean class which implements ApplicationContextAware interface   */ @Component public class SpringApplicationContextFactory implements ApplicationContextAware {     static ApplicationContext ctx;     @Override     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {         ctx = applicationContext;     }     public static ApplicationContext getContext() {         return ctx;     } } When an ApplicationContext creates a class that implemetns the ApplicationContextAware...

My experience with Adwords profit sharing

This is what I got from G Adwords for putting adds on this blog. Page impr    Clicks      Page CTR        eCPM            Earnings 3119             11            0.35%                0.89                       $2.79 And this is what one of my client paid for promoting his business via adwords. Page impr    Clicks      Page CTR       eCPM            Costs  3537                  2...

Why its not easy to find Good Java Developers.

Recently I came across lots of post trying to unlock why its difficult to find good Java Developers so I wanted to share my view on this topic. I've been training people on Java since 2007 for various consulting companies. First lets consider the time it takes to become an expert in PHP Development. A good php developer is expected to know these technologies (PHP, HTML, CSS, Javascript, SQL, Photoshop), and in 1 month of training he can start coding in php and in an year he will have nice grip over all these technologies. So a guy with 1yr of experience is good enough to be considered for most of the php jobs.  Now lets consider what it takes to become a good Java developer, most of the posts on job portals will look like this Java, SQL, ORM, MVC, HTML, Unit testing, Servlets, JSP, JDBC, AJAX, Design Patterns, Web Services, and IOC. Most of the students coming straight out of the college know quite a bit of Java, They write desktop and web application using very ...

Its Employers who need to be competent to find good Java Developers

Recently I came across lots of post trying to unlock why its difficult to find good Java Developers so I wanted to share my view on this topic. I've been training people on Java since 2007 for various consulting companies. First lets consider the time it takes to become an expert in PHP Development. A good php developer is expected to know these technologies (PHP, HTML, CSS, Javascript, SQL, Photoshop), and in 1 month of training he can start coding in php and in an year he will have nice grip over all these technologies. So a guy with 1yr of experience is good enough to be considered for most of the php jobs.  Now lets consider what it takes to become a good Java developer, most of the posts on job portals will look like this Java, SQL, ORM, MVC, HTML, Unit testing, Servlets, JSP, JDBC, AJAX, Design Patterns, Web Services, and IOC. Most of the students coming straight out of the college know quite a bit of Java, They write desktop and web application using very less standar...