Monday, July 13, 2020

Show json object in a input field-angularjs

<div class="floating-label">
          <input class="form-control floating-input"  placeholder=" " value="{{field_pluginData}}">
          <span class="highlight"></span>
          <label>Plugin Data</label>
        </div>
this.field_pluginData = JSON.stringify(respData[0]);

Friday, July 10, 2020

Monday, February 11, 2019

How to round float numbers in javascript?

Float value rounded number

javascript "toFixed()" predefined function  using

(6.688689).toFixed(); // equal to 7
(6.688689).toFixed(1); // equal to 6.7
(6.688689).toFixed(2); // equal to 6.69
MDN using rounded value

Math.round10(5.25, 0);  // 5
Math.round10(5.25, -1); // 5.3
Math.round10(5.25, -2); // 5.25
Math.round10(5, 0);     // 5
Math.round10(5, -1);    // 5
Math.round10(5, -2);    // 5

Thursday, January 31, 2019

How can I send a Firebase Cloud Messaging notification without use the Firebase Console?

FCM cloud message notification send mobile device on simple method try this code

$ch = curl_init();
$registration_ids="YOUR DEVICE ID";
ignore_user_abort();
ob_start();
$url = 'https://fcm.googleapis.com/fcm/send';
$message = 'Name:"Vengadeshwaran" Contact number:"888XXXX-XXX"';
$fields = array(
'registration_ids' => array($registration_ids),
'priority' => 10,
'notification' => array('title' => 'Birthday', 'body' => $message ,'sound'=>'Default'),
);
$google_api_key = 'WEB API KEY';
$headers = array(
'Authorization:key='.$google_api_key,
'Content-Type: application/json'
);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$status = curl_exec($ch);
curl_close($ch);
echo $status;

Wednesday, August 29, 2018

Laravel Mail send multiple email and cc

        $data=['email'=>$email,'subject'=>'ISS WORLD Account Details','bodymessage'=>$msg,'admin'=>$adminId];
     $result= Mail::send(array(), $data,function($message) use ($data){
                $message->from('vengadeschinz@gmail.com','ISS-WORLD');
               $message->to($data['email']);
             
                $message->cc($data['admin']);
                $message->subject($data['subject']);
);
      

Thursday, August 23, 2018

HTML to XLS export

 $("#export_xls").click(function(e){
    // alert('asdfasd');
    // $("#reports").table2excel({
    //   // exclude CSS class
    //   exclude: ".noExl",
    //   name: "Worksheet Name",
    //   filename: "SomeFile" //do not include extension
    // });
   // alert('hello');
    //getting values of current time for generating the file name
    var tab_text = '<html xmlns:x="urn:schemas-microsoft-com:office:excel">';
  tab_text = tab_text + '<head><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>';
  tab_text = tab_text + '<x:Name>Test Sheet</x:Name>';
  tab_text = tab_text + '<x:WorksheetOptions><x:Panes></x:Panes></x:WorksheetOptions></x:ExcelWorksheet>';
  tab_text = tab_text + '</x:ExcelWorksheets></x:ExcelWorkbook></xml></head><body>';
  tab_text = tab_text + "<table border='1px'>";
  var exportTable = $('#reports').clone();
  exportTable.find('input').each(function (index, elem) { $(elem).remove(); });
  tab_text = tab_text + exportTable.html();
  tab_text = tab_text + '</table></body></html>';
  var fileName = 'yearplanner_' + parseInt(Math.random() * 10000000000) + '.xls';

  //Save the file
  var blob = new Blob([tab_text], { type: "application/vnd.ms-excel;charset=utf-8" })
  window.saveAs(blob, fileName);
  /////////////////////////////
   
  });