Thursday, 9 February 2023

Google maps with multiple markers

 <!DOCTYPE html>

<html> 
<head> 
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
  <title>Google Maps Multiple Markers</title> 
  <script src="http://maps.google.com/maps/api/js?key=YOUR_API_KEY" 
          type="text/javascript"></script>
</head> 
<body>
  <div id="map" style="width: 500px; height: 400px;"></div>

  <script type="text/javascript">
    var locations = [
      ['Bondi Beach', -33.890542, 151.274856, 4],
      ['Coogee Beach', -33.923036, 151.259052, 5],
      ['Cronulla Beach', -34.028249, 151.157507, 3],
      ['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
      ['Maroubra Beach', -33.950198, 151.259302, 1]
    ];
    
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 10,
      center: new google.maps.LatLng(-33.92, 151.25),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });
    
    var infowindow = new google.maps.InfoWindow();

    var marker, i;
    
    for (i = 0; i < locations.length; i++) {  
      marker = new google.maps.Marker({
        position: new google.maps.LatLng(locations[i][1], locations[i][2]),
        map: map
      });
      
      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
          infowindow.setContent(locations[i][0]);
          infowindow.open(map, marker);
        }
      })(marker, i));
    }
  </script>
</body>
</html>

Thursday, 15 April 2021

Softwares for website use

 https://xenus-link-sleuth.en.softonic.com/     

XENU for checking broken links


https://www.xnview.com/en/xnconvert/

For image conversion

Sunday, 3 March 2019

add signature to form using canvas complete code

https://drive.google.com/open?id=1tC70CUmKbfCke9DPRWoYmA_1VBPzurig

save canvas as file to server php

////testSave.php////////////////
<?php
if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
  // Get the data
  $imageData=$GLOBALS['HTTP_RAW_POST_DATA'];

  // Remove the headers (data:,) part.
  // A real application should use them according to needs such as to check image type
  $filteredData=substr($imageData, strpos($imageData, ",")+1);

  // Need to decode before saving since the data we received is already base64 encoded
  $unencodedData=base64_decode($filteredData);

  //echo "unencodedData".$unencodedData;
 
  //=============
    $limit = 4;
    $digit_str   = '0123456789';
    $digit = substr(str_shuffle($digit_str), 0, $limit);
    //======================
    $letter_str='abcdefhigklmnopqrstuvwxyz';
    $letter = substr(str_shuffle($letter_str), 0, $limit);
    //==================
    $filename="CANVAS$digit$letter.png";
  
    echo $filename;

  // Save file. This example uses a hard coded filename for testing,
  // but a real application can specify filename in POST variable
 // $fp = fopen( 'test.png', 'wb' );
  $fp = fopen( $filename, 'wb' );
  fwrite( $fp, $unencodedData);
  fclose( $fp );
}
?>


<!DOCTYPE html>
<html>
<head>
<title>
How To Save HTML5 Canvas Into File
</title>
<meta name="Keywords" content="html, html5, javascript canvas tutorial, javascript canvas, todataurl, saving, web development, ajax" />
<meta name="Description" content="html 5, html5, javascript canvas tutorial for web development, saving canvas" />
<script type="text/javascript">

//****************************************************************
// Example function save save canvas content into image file.
// www.permadi.com
//****************************************************************
function saveViaAJAX()
{
    var testCanvas = document.getElementById("testCanvas");
    var canvasData = testCanvas.toDataURL("image/png");
    var postData = "canvasData="+canvasData;
    var debugConsole= document.getElementById("debugConsole");
    debugConsole.value=canvasData;

    //alert("canvasData ="+canvasData );
    var ajax = new XMLHttpRequest();
    ajax.open("POST",'testSave.php',true);
    ajax.setRequestHeader('Content-Type', 'canvas/upload');
    //ajax.setRequestHeader('Content-TypeLength', postData.length);


    ajax.onreadystatechange=function()
      {
        if (ajax.readyState == 4)
        {
            alert(ajax.responseText);
            // Write out the filename.
                document.getElementById("debugFilenameConsole").innerHTML="Saved as<br><a target='_blank' href='"+ajax.responseText+"'>"+ajax.responseText+"</a><br>Reload this page to generate new image or click the filename to open the image file.";
        }
      }

    ajax.send(postData);
}

</script>
</head>

<body>

     <div>
        <canvas id="testCanvas" width="300" height="300"></canvas>
      </div>
      <div>
    <textarea id="debugConsole" rows="10" cols="60">Data</textarea>
       <p><button onclick="saveViaAJAX();">Save Via AJAX</button>   <p>
    <div id="debugFilenameConsole">Wait for a while after clicking the button and the filename of the image will be shown to you.  </div>
      </div>
    <script type="text/javascript">
        // This portion of the code simply draws random circles into the canvas (it has nothing todo with saving the canvas).
        var canvas = document.getElementById("testCanvas");
        if (canvas.getContext)
        {
            var canvasContext = canvas.getContext("2d");
            for (i=0; i<150; i++)
            {
                canvasContext.fillStyle="rgb("+(parseInt(Math.random()*255))+","+(parseInt(Math.random()*255))+","+(parseInt(Math.random()*255))+")";
                canvasContext.beginPath();
                canvasContext.arc(Math.random()*350,Math.random()*350,Math.random()*20, 0,Math.PI*2,true);
                canvasContext.fill();
            }
        }
    </script>
  </body>

</html>

Wednesday, 20 February 2019

add at end of TCPDF to save file in folder

$pdf->writeHTML($txt, true, false, true, false, '');
//=============
$limit = 4;
$digit_str   = '0123456789';
$digit = substr(str_shuffle($digit_str), 0, $limit);
//======================
$letter_str='abcdefhigklmnopqrstuvwxyz';
$letter = substr(str_shuffle($letter_str), 0, $limit);
//==================
$filename="LGHT$digit$letter.pdf";
//$dir='/var/www/html/pdf/pdf_files/';
$dir= $_SERVER["DOCUMENT_ROOT"].'param/temp_reports/';
/*PDF info page */
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Lighthouse247');
$pdf->SetTitle($filename);
$pdf->SetSubject('INVOICE Lighthouse247');
//$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
/*Save pdf file to folder*/
$pdf->Output($dir.$filename, 'F');
//$download_link = "http://$_SERVER[HTTP_HOST]/pdf/pdf_files/$filename";
//$download_link = $_SERVER['HTTP_HOST']."/pdf_files/$filename";
$download_link = "http://localhost/param/temp_reports/$filename";

/*Apear Download link on screen*/
echo $result="<a href='$download_link' download>
  <img src='pdf.png' alt='download' width='104' height='142'>
</a>";

Monday, 31 December 2018

windows 10internnet issue

There is a known issue with Windows 10 Home: (OS build 17134.112)
The ethernet card was not immediately recognized by Windows 10 operating system.

If this happens, click the windows button + x, and open "Windows PowerShell (Admin)"

Enter the following:
netsh interface ipv4 reset
netsh interface ipv6 reset

Reboot and the ethernet card should now be recognized.

Wednesday, 30 May 2018