Posts

Showing posts from November, 2013

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) {             return i;            }     }

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_Date' >= '"+startDate+"' AND 'End_Date' <= '"+endDate+"' " +                         " AND   'DMA_Code' >0 " //'Start_Date >= '+startDate+' 00:00:00'               },                                            styles: [{                                     where: 'Available_Impressions > 0 AND Ava