How to disable cache for images in all browsers

This tag was recommended by some developers but it may not work if you have dynamic file uploaded to your server. <img src=”my-image.jpg?cache=1″> The best tag you can add to display a brand new image is to use the function time() in php to generate different time for each time a photo was uploaded to your server. <img src=”my-image.jpg?cache=<?=time()?>”>

Continue reading »

PHP versions and support by PHP Community

If your website is still running on legacy php version, you may consider to upgrade PHP version and your website’s source code to protect your website from future malware / malicious attack. The newer PHP version, the faster the performance, the more secure, and more efficient. PHP 4: no longer supported by PHP Community 1&1 Extended Support available PHP 5.2: no longer supported by PHP Community 1&1 Extended Support available PHP 5.4: no longer supported by PHP Community 1&1 Extended Support available PHP 5.5: no…

Continue reading »

To execute a function inside in external .js file

To execute a function inside in external .js file, use $( window ).load. $(document).ready(function(){ is used to load .js file or loading js functions but those functions won’t be execute. create set_user_status.js file, it looks similar to this: function setUserStatus(v1,v2,v3){ alert(v1+ v2+ v3); //or console.log(v1+ v2+ v3); } The header will preload the external .js file like this: <script type=”text/javascript” src=”js/set_user_status.js”></script> To execute the function setUserStatus inside the external .js file, use $( window ).load $( window ).load(function() {//works setUserStatus( “value1”, “value2”, “value3”); });

Continue reading »

HTML5 Canvas Cheatsheet

HTML5 Canvas Element Html5 canvas element <canvas id=”myCanvas” width=”500″ height=”300″> Html5 canvas element with fallback content <canvas id=”myCanvas” width=”500″ height=”300″> your browser doesn’t support canvas! </canvas> 2d context var context = canvas.getContext(‘2d’); Webgl context (3d) var context = canvas.getContext(‘webgl’); Shapes Draw rectangle context.rect(x, y, width, height); context.fill(); context.stroke(); Fill rectangle shorthand context.fillRect(x, y, width, height); Stroke rectangle shorthand context.strokeRect(x, y, width, height); Draw circle context.arc(x, y, radius, 0, Math.PI * 2); context.fill(); context.stroke(); Styles Fill context.fillStyle = ‘red’; context.fill(); Stroke context.strokeStyle = ‘red’; context.stroke(); Linear…

Continue reading »