Posts

appengine:devserver_stop not working in Windows 8/eclipse

If you have added appengine:devserver_stop in eclipse as a debug goal in maven goals and still you are not able to stop the server then you can manually close the server on given port. Let's take an example that your server is running on 8080 that you want to stop. 1) Open command line prompt:    netstat -a -n -o You will get following output......  Proto  Local Address          Foreign Address        State           PID  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       700  TCP    0.0.0.0:445            0.0.0.0:0         ...

DFP API works fine at localhost but failed Google App engine (access denied ("java.lang.RuntimePermission" "getClassLoader")

DFP API works fine at localhost but failed Google App engine (access denied ("java.lang.RuntimePermission" "getClassLoader") --------------------------------------------------------------------------  com.google.api.ads.common.lib.exception.ServiceException: Unexpected Exception.     com.google.api.ads.common.lib.soap.jaxws.JaxWsHandler.createSoapClient(JaxWsHandler.java:210)     com.google.api.ads.common.lib.soap.jaxws.JaxWsHandler.createSoapClient(JaxWsHandler.java:1)     com.google.api.ads.common.lib.factory.helper.BaseAdsServiceClientFactoryHelper.createSoapClient(BaseAdsServiceClientFactoryHelper.java:106)     com.google.api.ads.common.lib.factory.helper.BaseAdsServiceClientFactoryHelper.createAdsServiceClient(BaseAdsServiceClientFactoryHelper.java:71)     com.google.api.ads.common.lib.factory.AdsServiceClientFactory.getServiceClient(AdsServiceClientFactory.java:73)     com.google.api...

Writing a zip file on Google App engine

package com.lin.web.servlet; import java.io.BufferedWriter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import com.google.api.client.http.ByteArrayContent; import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestFactory; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpTransport; import com.google.api.cl...

Send POST request with JSON data on Google App Engine

Tag: Fusion Table Rest API, Send POST request with JSON data on Google App Engine 1) Create fusion table using post request on Google App Engine // postURL= "https://www.googleapis.com/fusiontables/v1/tables?access_token=**********" // access_token - Use Oauth2 for this public static String sendPostRequest(String postURL) throws Exception{         String responseStr=null;         //make POST request         String jsonContent = "{'name': 'newIndia','columns': [{'name': 'Species','type': 'STRING'}],'description': 'Insect Tracking Information.','isExportable': true}";         //String data = "{\"document\" : {\"_id\": \"" + id+ "\", \"context\":" + context +"}}";         URL url = new URL(postURL);         HttpURLConnection connection = (HttpURLConnection) url.openConnection();  ...

Best way to Format a Double value to nth Decimal places in Java

Best way to Format a Double value to nth Decimal places in Java ------------------------------------------------------------------ public static double getDoubleValue(String value,int digit){         if(value==null){             value="0";          }         double i=0;          try {              DecimalFormat digitformat = new DecimalFormat("#.##");              digitformat.setMaximumFractionDigits(digit);             return Double.valueOf(digitformat.format(Double.parseDouble(value)));                     } catch (NumberFormatException numberFormatExp) {         ...

Append option into a select using jquery

You can use jquery to append data from select from a array of data. See the java script function where you can pass the dataArray like dataArray=["A","B"] and elementId , means the id attribute of your select element; function appendDataToSelectDropDown(dataArray, elementId ){       if(dataArray !=null && dataArray.length>0){           $('#'+ elementId ).find('option').remove().end()             .append('<option value="-1">Select Creative Size</option>');           $.each(dataArray, function( index, value ) {                    $('#'+ elementId ).append(new Option(value, value));           });       }   }

Fusion table layer: data may be still loading

On hitting fusion table layer on Maps, it says data may be still loading Answer : Check your query syntex, new query syntex is as given below with an example (Non numeric fields must be enclosed with '' quotes) function fetchDataFromFusionTable(){    try{                            var fusionOptions = {                             query: {                 select: 'Geometry',                 //from: "1QTnVfSO-agR4ueOAVa-uUzYrmNwE4DQ6l0e22EA",                 from: "1Fhnl0uOC3Ol3rMHI5FQIiTDIP3gw7QbRjldvFgY",                 where: " 'Start_Da...