IT Certificaions

Google Cloud Platform

Wednesday, April 25, 2012

Site down: Time out erro (Apache server with tomcat 6)

Can any one find the solution for  this ?????

error.log file........................

[Tue Apr 24 17:19:28 2012] [error] [client 66.249.68.225] (104)Connection reset by peer: proxy: error reading status line from remote server localhost
[Tue Apr 24 17:19:28 2012] [error] [client 66.249.68.225] proxy: Error reading from remote server returned by /robots.txt
[Tue Apr 24 17:19:58 2012] [error] [client 175.41.139.6] (104)Connection reset by peer: proxy: error reading status line from remote server localhost
[Tue Apr 24 17:19:58 2012] [error] [client 175.41.139.6] proxy: Error reading from remote server returned by /
[Tue Apr 24 17:23:19 2012] [error] [client 175.41.139.6] (104)Connection reset by peer: proxy: error reading status line from remote server localhost
[Tue Apr 24 17:23:19 2012] [error] [client 175.41.139.6] proxy: Error reading from remote server returned by /Home.action



access.log file............

175.41.139.6 - - [24/Apr/2012:17:16:24 +0000] "GET / HTTP/1.0" 502 666 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"
175.41.139.6 - - [24/Apr/2012:17:19:45 +0000] "GET /Home.action HTTP/1.1" 502 654 "-" "check_http/v1.4.15 (nagios-plugins 1.4.15)"

Monday, April 23, 2012

Facebook error response of type OAuthException: Error validating application. Invalid application ID

Console error: Facebook responded with HTTP status code 400 and response body: {"error":{"message":"Error validating application. Invalid application ID.","type":"OAuthException","code":190}}

---------------------------------------------------------------------------
com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: Error validating application. Invalid application ID.
 com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:576)
 com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:537)
 com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:485)
 com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:445)
 com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:405)
 com.restfb.DefaultFacebookClient.fetchObject(DefaultFacebookClient.java:250)
 com.vicwalks.web.util.SocialMediaUtil.getFBUserInfoUsingRest(SocialMediaUtil.java:97)
 com.vicwalks.web.service.impl.SocialMediaService.getFacebookUserDetails(SocialMediaService.java:88)
 com.vicwalks.web.action.FacebookLoginAction.loginStatus(FacebookLoginAction.java:75)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 java.lang.reflect.Method.invoke(Unknown Source)
.................
..................
................



Solution: Please check the URL that you are sending to facbook to fetch user details. For example, 
https://graph.facebook.com/me/permissions?access_token=AAACchSmfp9ABAL22hBqtv591lpzZAqU7NhKD0gJT9n1lI4mUXIK67Mk66i0jKfWdXn0kOTo6vYp0xcrnZBmphXsrfDjuBMiCt34ZAWthQZDZD&expires

So see here the Access token conatins '&expires' string at the end, so remove it and send again.

Wednesday, April 18, 2012

Java Script: Remove space in a String

How to remove spaces from a string in java script?

Add the following code snippet in your your java script code:


String.prototype.contains = function(it) { return this.indexOf(it) != -1; };
function removeSpace(text){
   while(text.contains(' ')){
       text=text.replace(' ','');
   }
}

Thursday, April 5, 2012

Google map: calculate distance between two points(Marker)

rad = function(x) {
            return x*Math.PI/180;
         }

distanceUsingHaversine = function(sourcePoint, destinationPoint) {
     var RADIUS = 6371;    // earth's mean radius in km
    var diff_Lat  = rad(destinationPoint.lat() - sourcePoint.lat());
    var diff_Long = rad(destinationPoint.lng() - sourcePoint.lng());

    var a = Math.sin(diff_Lat/2) * Math.sin(diff_Lat/2) +
          Math.cos(rad(sourcePoint.lat())) * Math.cos(rad(destinationPoint.lat())) * Math.sin(diff_Long/2) *     Math.sin(diff_Long/2);
  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
  var dist =RADIUS * c;

  return dist.toFixed(3);
}