Category : "Coding"

All kinds of Programming.

Add a stop function to the html5 audio element

The Audio element of html5 does not yet have a stop function, but has a pause function. So here is a simple trick to add a stop function to your Audio elements by modifying the prototoype of the class. //Give the Audio element a stop function HTMLAudioElement.prototype.stop = function() { this.pause(); this.currentTime = 0.0; } The function would first pause the audio element, then would set the ...

Using the html5 audio element from javascript

Sometime back I was making a browser based game in the html5 canvas tag which had some audio too. The html5 audio tag is an easy option to add sound/music to any webpage. It can play variety of formats like wav, ogg and mp3. However format support itself varies across browsers. The audio element can be directly added to html in ...

Make a simple html5 game with box2d in javascript – tutorial

Demo First lets play the game that we shall be making in this tutorial. Its called Fruit Hunter. Tested on Chrome and Firefox. Click in the game then start using the arrow keys to control the monkey. Press the left, right and up arrow keys to make the monkey move and jump. Do not fall off the stands and try to ...

Generate a dropdown list of timezones in php

Applications often allow users to select their timezones for reporting the proper time properly. Here is a quick function that can be used to generate a dropdown list of timezones that is easy to read and understand. <?php function get_timezones() { $o = array(); $t_zones = timezone_identifiers_list(); foreach($t_zones as $a) { $t = ''; try { //this throws exception for 'US/Pacific-New' $zone = new DateTimeZone($a); $seconds = $zone->getOffset( new DateTime("now" , $zone) ); $hours ...

Php array of iso 639-1 language codes and names

Here is a php array containing the language codes and language names as specified by the iso 639-1 standard. Useful when . <?php /** ISO 639-1 Language Codes Useful in Locale analysis References : 1. http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes 2. http://blog.xoundboy.com/?p=235 */ $language_codes = array( 'en' => 'English' , 'aa' => 'Afar' , 'ab' => 'Abkhazian' , 'af' => 'Afrikaans' , 'am' => 'Amharic' , 'ar' => 'Arabic' , 'as' => 'Assamese' , ...

Php function to get the last day of a month

Here is a function that would get the last day of a given month as a date in format Y-m-d. It first adds 1 month to the 1st date of the given month, then subtracts 1 second from the resulting date which brings back to the last date of the given month. /** Last date of a month of a year @param $month ...

Convert pdf to image with imagemagick in php

Imagick In a previous article we saw how to use to create a snapshot or thumbnail of the pdf. Now we are going to do the same in php using the Imagick class which provides the bindings for imagemagick library inside php. The library is available in the form of a class Imagick that does all the job of imagemagick ...

Php curl tutorial – making http requests in php

Curl According to the official website. curl is a command line tool for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, ...

Generate code39/isbn barcodes in php with mpdf

Barcodes Barcodes are used in various business class applications to print information in encoded format such that it can be read later by barcode reading devices. Common places to see barcodes are product covers in shops, membership cards and documents like invoices etc. As php is now increasingly being used to develop such applications, barcodes need to be printed from php. There ...

6 tips to learn PHP fast and effectively

Php is today the most widely used language/platform for development of web based applications and websites. At the same time it is the easiest to learn and use. There are lots of free tutorial websites out there that can be followed to learn php without much effort. Along with these tools having the right approach can speed up the learning ...

Pages:«12345678...19»


Connect with us