AWS Use of undefined constant CURLE_COULDNT_RESOLVE_HOST
August 22, 2014
It appears that you are missing curl. If you are linux you can usually install it via the package manager package would be named something similar to php-curl. If windows, enable the curl extension in php.ini To check if curl installed in php, you may create a phpinfo.php file in your server root and run […]
Ubuntu phpmyadmin connect to mysql error: #2002 cannot log in to the mysql server
August 22, 2014
If phpmyadmin cannot connect to mysql error: #2002 cannot log in to the mysql server Run: sudo nano /etc/mysql/my.cnf Update bind-address = 192.168.0.2 To bind-address = localhost This fixed the problem. Enjoy. ref: here
Ubuntu 10.04.4 upgrade php 5.3.2 to 5.3.6
August 22, 2014
For anyone who wants to upgrade Ubuntu 10.04 LTS to PHP 5.3.10, this is how I have done it. Note sudo apt-add-repository ppa:brianmercer/php5 doesn’t work anymore. Suspect has been taken down. sudo apt-add-repository ppa:brianmercer/php5 will not work anymore However the steps below do work!! sudo add-apt-repository ppa:bjori/php5 sudo apt-get update sudo aptitude show php5 Package: […]
PHP get first key in associative array
August 7, 2014
If efficiency is not that important can use array_keys($yourArray)[0] in PHP 5.4 (and higher). Output: a
jQuery handle null value in PHP variable or array
August 6, 2014
Handling php array or variable inside javascript directly using json_encode, will result some value null. To check null using jquery in this case:
jQuery select list set selected using php variable
August 6, 2014
Using jQuery to set the selected element of the select control to be the item with the text description. Value from php.
jQuery Datepicker does not work in dynamic element
August 5, 2014
This always happen when bind the event initially, the new field doesn’t exist. A better way is initialize the datepicker for the field when create the element. Example after an AJAX call to build the fields:
Google maps api key for localhost
July 30, 2014
For google maps api v3, the key must be empty for it to work in localhost. Older version key check is skipped for http://localhost/. You could use the key that you intend to use on your live domain, or anything else. If you use a port number with localhost, then you can obtain a key […]
PHP check a string is an email address format
July 29, 2014
With PHP v5.2.0 or greater, you may use regular expressions.
jQuery add attribute to html element and remove
July 25, 2014
You can add attributes using attr like below: To remove: However, for DOM properties like checked, disabled and readonly, the proper way to do this (as of JQuery 1.6) is to use prop. To remove:
Recent Comments