Monday, November 15, 2010
Waiting for changelog lock.... at SpringSource Tool Suite 2.5.1
Friday, November 12, 2010
problem:
using Quartz + Spring + PostreSQL
55028 [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_QuartzSchedulerThread] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
55029 [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_QuartzSchedulerThread] ERROR org.quartz.core.ErrorLogger - An error occured while scanning for the next trigger to fire.
org.quartz.JobPersistenceException: Couldn't acquire next trigger: Couldn't retrieve trigger: Bad value for type long : [See nested exception: org.quartz.JobPersistenceException: Couldn't retrieve trigger: Bad value for type long : [See nested exception: org.postgresql.util.PSQLException: Bad value for type long : ]]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2789)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$36.execute(JobStoreSupport.java:2732)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3763)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2728)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264)
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve trigger: Bad value for type long : [See nested exception: org.postgresql.util.PSQLException: Bad value for type long : ]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1571)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1547)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2767)
... 4 more
Caused by: org.postgresql.util.PSQLException: Bad value for type long :
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toLong(AbstractJdbc2ResultSet.java:2736)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getLong(AbstractJdbc2ResultSet.java:2032)
at org.postgresql.jdbc2.Jdbc2ResultSet.getBlob(Jdbc2ResultSet.java:52)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBlob(AbstractJdbc2ResultSet.java:337)
at org.apache.commons.dbcp.DelegatingResultSet.getBlob(DelegatingResultSet.java:565)
at org.apache.commons.dbcp.DelegatingResultSet.getBlob(DelegatingResultSet.java:565)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.getObjectFromBlob(StdJDBCDelegate.java:3462)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:2132)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1553)
... 6 more
Solution:
Use the PostgresSQL driver delegate class
Replace:
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
with
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
Wednesday, November 10, 2010
Configure memory settings of SpringSource Tool Suite (STS) on Mac OSX
Wednesday, October 27, 2010
Using SpringSource Tool Suite (STS) Template
Friday, May 7, 2010
thumbs116x116.dat reader
If anyone can beautify it, please send me a copy, thanks.
public static Bitmap readThumbsAlternative(byte[] search, String szSearch) {
// file:///SDCard/BlackBerry/pictures/image.jpg
szSearch = szSearch.substring(szSearch.lastIndexOf('/')+1,szSearch.length());
// convert the search string to bytes for easier comparison
byte[] searchtmp = szSearch.getBytes();
int lastbyte = 0;
int endIndex = 0;
for (int x = 0; x < search.length; x++) {
boolean found = false;
// For the length of searchtmp trying to find a match in the byte file
// we could also have converted search to String [new String(search)]
// and have done an index of however I prefer direct byte access as lookups tend to be faster
for (int y = 0; y < searchtmp.length; y++) {
if (search[x + y] == searchtmp[y]) {
lastbyte = x + y + 1;
found = true;
} else {
found = false;
break;
}
}
if (found) {
for (int y = lastbyte; y < search.length; y++) {
byte first = search[y];
byte second = (y < search.length - 1) ? search[y + 1] : search[y];
String firstS = Integer.toString((first & 0xff) + 0x100, 16).substring(1);
String secondS = Integer.toString((second & 0xff) + 0x100, 16).substring(1);
if (firstS.equals("ff") && secondS.equals("d9")) {
endIndex = y + 1;
break;
}
}
if (endIndex>0) {
break;
}
}
}
if (lastbyte > 0 && endIndex > 0) {
byte[] b = new byte[lastbyte + endIndex];
int counter = 0;
for (int i = lastbyte; i <= endIndex; i++) {
b[counter] = search[i];
counter++;
}
EncodedImage ei = EncodedImage.createEncodedImage(b, 0, b.length);
Bitmap bt = ei.getBitmap();
return bt;
}
return _loadingImage;
}
Thursday, May 6, 2010
reading BBThumbs.dat thumbnail
Solution: Read the thumbnail generated by BlackBerry's image browser.
Here are the files of the thumbnails:
for newer OS:
1. file:///SDCard/BlackBerry/system/media/thumbs116x116.dat
2. file:///store/appdata/rim/media/thumbs116x116.dat
or thumbs480x360.dat if you want bigger thumbnails
*** I didn't need to use the .key file, if anyone knows what does the .key file do, would you please let me know?
read the file as EXIFs by stripping the data FFD8XXXX...XXXXFFD9
www.media.mit.edu/pia/Research/deepview/exif.html
for older OS:
3. file:///SDCard/BlackBerry/pictures/BBThumbs.dat
4. file:///store/home/user/pictures/BBThumbs.dat
read the file as PNGs by using the code snippet from
supportforums.blackberry.com/t5/Java-Development/Thumbnails-work-around/m-p/343870
Monday, February 22, 2010
BlackBerry API - SMS - DatagramConnection.send() hangs/freezes
public void SendSMS(String input){
try {
DatagramConnection dgConn;
dgConn = (DatagramConnection)Connector.open("sms://15195555555");
byte[] data = input.getBytes();
Datagram dg = dgConn.newDatagram(dgConn.getMaximumLength());
dg.setData(data, 0, data.length);
dgConn.send(dg); <------ hangs right here!!!! and no Throwable was ever thrown!!!
} catch (Throwable t) {
t.printStackTrace();
}
}
Solution:
Check the length of the message, in my case, it hangs when the message is >160 in length.