GIT undo merge local and remote repo
April 24, 2014
In local or remote, wrong merge will require to revert immediately. But do not use hard reset if the merge have not been committed. Immediately once did the merge process and found it wrong, to preserve changes we made before, use ORIG_HEAD: If the wrong merge has conflict and haven’t committed, use abort with newer […]
PHP get array keys only of arrays
April 24, 2014
You can use PHP’s array_keys function to grab the keys: Typical way is loop foreach:
GIT merge remote repository to local branch
April 16, 2014
First, add the remote repository $ git remote add Example: $ git remote add test-repo git@bitbucket.org:testing/testing-repository Then, pull the remote branch or master to local branch. If local branch has not been created yet, create local branch: $ git branch test_pull Checkout the branch $ git checkout test_pull Now, pull remote branch which named as […]
PHP String “0″ or empty issue
April 15, 2014
Given example an empty value of array like: When processed the array and $value = $x->track_value Output value will be always “Manuals”. To fix this issue, add “” into the “1″ or “0″
PHP get latitude and longitude using google maps API
April 15, 2014
Example: Output longitude and latitude which can be very useful for location services. Detailed variable setting see below reference: https://developers.google.com/maps/articles/phpsqlsearch_v3#findnearsql http://stackoverflow.com/questions/8633574/get-latitude-and-longitude-automatically-using-php-api
CSS rounded corner for border, div or button
April 15, 2014
For cross browser use -webkit and -moz to get best result. Example rounded corner 5px.
PHP remove duplicate key or value in multidimensional array
April 15, 2014
Example this multidimensional array having duplicate retailer_id, and we want no duplicate of retailer id in the array although it keep different id information: To clean above: $outputArray is the final clean array. If we want to remove existing key from an array: simply:
PHP trim multiple 00 infront
April 15, 2014
If the number provided is a string, convert it to int and will auto remove the addtional 00:
PHP Prepare IN statement from array
April 14, 2014
Some of us may not know that when preparing mysql IN statement, the string inside the IN() need to be single quoted and separated by comma. Example: Unless it is a number. Otherwise double quote or no quoting the string will give you error. Example: WHERE categories IN (“red”, “blue”, “green”) To prepare IN statement […]
PHP how to destroy session id
April 14, 2014
The unset() function is used to free the specified session variable: or better catch
Recent Comments