Tuesday, September 25, 2012

Google Talk: Run Multiple Instances or Log In as Multiple Users

Google Talk: Run Multiple Instances or Log In as Multiple Users


If you have several Google Talk accounts, you may want to run multiple instances of Google Talk at once. Here is how to do it.


Many users, including myself, like to have several different personalities on IM. By default, Google Talk will only allow you to run one instance of the program at a time. You can get around that using these instructions.
Run Google Talk with the following switch: /nomutex.
If you installed Google Talk to the default location, you can easily create a shortcut to this setting.
    1. Right-click on the desktop.
    2. Select New.
    3. Select Shortcut.
    4. Paste this into the text box:
    "c:\program files\google\google talk\googletalk.exe" /nomutex
      5. Click Next
      6. Name it whatever you wish (i.e., Google Talk Multiple, etc.)
      7. Click OK until you are done.
Credit goes to the Neowin Forum for the original idea:
http://www.neowin.net/forum/index.php?showtopic=363145&st=0

Saturday, September 15, 2012

How to use JPA using data-source on tomcat?

How to use JPA using data-source on tomcat?

Step :1 Add following details to context.xml of tomcat server
    <Resource auth="Container"
   driverClassName="com.mysql.jdbc.Driver"
   maxActive="20"
   maxIdle="10"
   maxWait="-1"
   name="jdbc/myconnection"
   password="admin"
   type="javax.sql.DataSource"
   url="jdbc:mysql://localhost:3306/test?auto_reconnect=true&amp;relaxAutoCommit=true"
   username="root"/>

Step 2 : Add resource-ref in web.xml
<resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/myconnection</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>


Step 3: Add following details in persistence.xml
<persistence 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"
    version="1.0">
<persistence-unit name="jpa" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <non-jta-data-source>java:comp/env/jdbc/myconnection</non-jta-data-source>
     <properties>
            <property name="hibernate.connection.datasource" value="java:comp/env/jdbc/myconnection"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.id.new_generator_mappings" value ="true"/>
  
        </properties>
    </persistence-unit>
</persistence>


Now your data-source is ready to connect database.

How to disable adf default row selection in <af:table>?

How to disable adf default row selection in <af:table>?

Problem Definition

In day to day development we faced common issue with using af:table row selection, because adf provide 1 row default selected. Some custom event we defined on row selection are not getting triggered on row if there is single row in table. It cause very big problem in application if those event must be triggered to populate some other data on row selection.

Solution Proposed

Solution I am proposing can solve that issue. I didn't tested every aspect but tested the scenario of making selected row as current row. After making these changes current row is getting set to viewobject properly and returning right values.

Remove the selectedRowKeys from <af:table>

After making these changes you screen looks like:
Here no row is selected in first table but first row is the current row in viewobject hence child table is showing default data for first row. you can make some changes to first view object so that there won't be any current row in viewobject. In that case child table won't display any row.

Anyway lets focus on the selection event triggering on first table. Now I have selected second row form first table and corresponding child record are showing in second table.

 

 Above testcase proved that there is no problem with selection event while removing the selectedRowKeys property of <af:table>

Find the working sample application on Sample Application