Posts

Struts 2 - struts tag with boolean property

Struts 2 - struts tag <s:if test= "booleanVaue" > with boolean property Always remember two points -- 1) Check your bean (.java) file for getter, setter for boolean type value   private boolean isTest;   private boolean hasCheck;    public boolean isTest() {         return isTest;     }     public void setTest(boolean isTest) {         this.isTest= isTest;     }    public boolean isHasCheck() {         return hasCheck;     }     public void setHasCheck(boolean hasCheck) {         this.hasCheck= hasCheck;     } ------------------------------------------------------------------------- On a jsp page if you are using these two variables in a <s:if> conditions <s:if test=" isTest "> // This will not work, will always ret...

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Permissions 0644 for '/root/.ssh/id_rsa' are too open. It is required that your private key files are NOT accessible by others. ------------------------ root@media-Vostro-1540:~/.ssh# ssh -T git@github.com @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/root/.ssh/id_rsa' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /root/.ssh/id_rsa Permission denied (publickey). Solution : First check the permission on id_rsa directory root@media-Vostro-1540:~/.ssh# ls -lrt total 12 -rw-r--r-- 1 root root 2160 Jun  4 15:05 known_hosts -rw-r--r-- 1 root root 1766 Jun  4 15:12 id_rsa -rw-r--r-- 1 root root  415 Jun  4 15:12 id_rsa.pub Ch...

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) {         ...