Sunday, January 23, 2011

Tip: Calculate distance between two GPS endpoints on Blackberry

If you are in need of determining the distance between two geo coordinates on blackberry, use the following piece of code.

====
import javax.microedition.location.Coordinates;

private double difference( double currentLat, double currentLon, double startLat, double startLon )
{
Coordinates current = new Coordinates(currentLat, currentLon, 0);
Coordinates start = new Coordinates(startLat, startLon, 0);
float diffInMetres = current.distance(start);
return diffInMetres * 0.000621371192; //Convert into miles
}
====

Friday, January 21, 2011

Tip: Eclipse and Linux Installation Troubleshoot

Problem: After installing Eclipse on Linux, if you get:
"Failed to load the JNI shared library /usr/java/jdk1.6.0_23/jre/bin/../lib/i386/client/libjvm.so"

or

"/opt/java/jdk1.6.0_23/bin/../jre/lib/i386/client/libjvm.so: cannot enable executable stack as shared object requires: Permission denied"

Solution:

If you have sudo rights,
$> sudo chcon -t execmem_exec_t '/opt/eclipse/eclipse'

Thursday, December 02, 2010

Tip::Pidgin and MSN connection issues

Typically you have errors such as :
The certificate for omega.contacts.msn.com could not be validated. The certificate chain is invalid.

Solution:

Assuming you are on Linux.

1) Delete the MSN related certificates.
==============
anil@localhost:~$ cd .purple/certificates/x509/tls_peers
anil@localhost:~/.purple/certificates/x509/tls_peers$ ls
api.oscar.aol.com contacts.msn.com login.live.com ows.messenger.msn.com
api.screenname.aol.com gmail.com login.yahoo.com rsi.hotmail.com
bos.oscar.aol.com omega.contacts.msn.com
anil@localhost:~/.purple/certificates/x509/tls_peers$ rm *live*
anil@localhost:~/.purple/certificates/x509/tls_peers$ rm *msn*
anil@localhost:~/.purple/certificates/x509/tls_peers$ rm rsi.hotmail.com
anil@localhost:~/.purple/certificates/x509/tls_peers$ rm login.live.com
================

2) In that particular directory, do a "wget"
$> wget http://bit.ly/dbLSzq -O omega.contacts.msn.com

3) In Pidgin, Accounts -> xxx.msn.com -> Disable Account
or Accounts -> xxx.hotmail.com ->Disable Account

4) Now enable the account in "Accounts"