Posts

Showing posts from January, 2013

Change timestamp by adding seconds in Java

1) Using Timestamp                  long myDate= System.currentTimeMillis();        int sec = 300;        Timestamp originalTime = new Timestamp(myDate);        Calendar calender = Calendar.getInstance();         calender.setTimeInMillis(originalTime.getTime());         calender.add(Calendar.SECOND, sec);         Timestamp afterAdd = new Timestamp(calender.getTime().getTime());        System.out.println(originalTime);        System.out.println(afterAdd); 2) Using given date           public void addTimeBySecondsDemo(Date date,int sec) {         //int sec = 300;         System.out.println("Given date:"+date);         Calendar calender...

com.google.appengine.api.memcache.MemcacheServiceException: Memcache put: Error setting single item

Uncaught exception from servlet com.google.appengine.api.memcache.MemcacheServiceException: Memcache put: Error setting single item (SearchedMvNews_key) at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl$7.transform(AsyncMemcacheServiceImpl.java:423) at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl$7.transform(AsyncMemcacheServiceImpl.java:415) at com.google.appengine.api.memcache.MemcacheServiceApiHelper$RpcResponseHandler.convertResponse(MemcacheServiceApiHelper.java:57) at com.google.appengine.api.memcache.MemcacheServiceApiHelper$1.wrap(MemcacheServiceApiHelper.java:101) at com.google.appengine.api.memcache.MemcacheServiceApiHelper$1.wrap(MemcacheServiceApiHelper.java:96) .... .... Sol: Please see the size that you are going to put in Memcache. It should not cross max size allowed.

Jquery Mobile issue: data-direction="reverse" changes transition direction

 Jquery Mobile issue: data-direction="reverse" changes transition direction    It modified transition from left to right for that page always...   Solution :    use : data-back="true" data-ajax="false" inplace of data-direction="reverse" 

Execute scripts inside document.getElementById().innerHTML

 Execute <script> (Java Script) tag from innerHTML  -------------------------------------------------------------  1. Replace <script> your script data to be executed. </script> tag     with <div class="javascript">your script data to be executed. </div>  2. add a style in your page...     <style type="text/css"> .javascript { display: none; } </style> 3. Now run  eval using jquery(Jquery js should be already included)      $('.javascript').each(function() {       eval($(this).text());     });

com.google.appengine.api.datastore.DatastoreNeedIndexException:

Uncaught exception from servlet com.google.appengine.api.datastore.DatastoreNeedIndexException: The index for this query is not ready to serve. See the Datastore Indexes page in the Admin Console. The suggested index for this query is:     <datastore-index kind="TrackUserDetails" ancestor="false" source="manual">         <property name="userId" direction="asc"/>         <property name="inTime" direction="desc"/>     </datastore-index> at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:39) at com.google.appengine.api.datastore.DatastoreApiHelper$1.convertException(DatastoreApiHelper.java:70) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:94) at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:86) at com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:71) at co...
HibernateException:Cannot convert value '0000-00-00 00:00:00' from column 15 to TIMESTAMP. org.hibernate.exception.GenericJDBCException: Cannot convert value '0000-00-00 00:00:00' from column 15 to TIMESTAMP. at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129) at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) at $Proxy9.executeQuery(Unknown Source) at org.hibernate.loader.Loader.getResultSet(Loader.java:1953) at org.hibernate.loader.Loader.doQuery(Loader.java:829) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(...

mysql local instance setup error on google app engine

 Exception:java.lang.ClassNotFoundException: com.mysql.jdbc.Driver java.lang.IllegalStateException:  java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at com.google.appengine.api.rdbms.dev.LocalRdbmsServiceLocalDriver.registerDriver(LocalRdbmsServiceLocalDriver.java:95) ---------------------------------- Sol: Put mysql-connectorXXXX.jar into .....XXX\appengine-java-sdk-1.7.3\lib\impl and run again.