October 17 2015

CSS removing dotted outline when click link

Tagged Under :

css3
A links <a> by default have a dotted outline around them when user click it, and it will be a gray color around on it.This is default styling for the purpose of accessibility. For folks without the ability to use a mouse, they still need some visual indicator that they currently have a link active.
css3
To remove the dotted outline, just include this as a part of your CSS
a:link, a:hover, a:active, a:focus {
  outline: 0;
}

August 31 2015

Android SDK click twice back button to exit

Tagged Under :

Android
A lot of Android users have experience accidentally exit the application when he click the back button.

To avoid this happen again. you can modify back button action to let user click twice before exit.
press again to exit

And also, you can display message “Press again to exit” to ask the user click again to exit the application.

July 29 2015

Mysql query to display name range from a to g

Tagged Under :

MySQL
I need to listing out name of the person start from lowercase a to g and uppercase A to G in MySQL. You can use MySQL regexp to get the results you want.

Example SQL:
SELECT * FROM USERS WHERE name REGEXP '^[A-G|a-g]'

The above query will listing out all the results where name start from a to g

June 28 2015

PHP some variable fail to post data to server

Tagged Under :

php
This was my first time facing this problem. When I post more than 1000 variable value to server, it only show me 1000 variable received and the rest was missing.

To solve this problem you need to increase max_input_vars number in PHP.ini to 3000 or 5000. It was because the max_input_vars default value was 1000. If you post more than the value server will ignore the rest.

if your server uses the Suhosin patch or after change the max_input_vars number the problem still same. you can try add
suhosin.post.max_vars = 3000 
suhosin.request.max_vars = 3000
to increase the maximum number of post variable.

June 08 2015

IOS css radius courners and glare on inputs

Tagged Under :

css3
Inside the iOS devices have add some annoying styles on form input, particularly on input box and submit button. Below are the simple form on Desktop and iOS browser.

Desktop:
css3

iOS:
css3

To fixed the border radius and gradient on IOS safari browser issue.
You can get rid of the webkits form, input, etc. styling with this:
input, textarea, select {
   -webkit-appearance: none;
}

May 19 2015

css div 100% height

Tagged Under :

css3
A lot of people are trying to set div to 100% inside the CSS to fill up the full height of browser window. But normally it wouldn’t work.

In here, I will showing you how to set 100% full height div with CSS. Inside the CSS class remember set html and body element to height 100%.
html, body {
  height: 100%;
}
After that, set the div CSS class to height 100% which you want it full height.
div.content {
  height: 100%;
}
And the HTML code will look like this
<html>
  <body>
    <div class="content">
      100% full height
    </div>
  </body>
</html>

Click here to see the DEMO.

April 14 2015

Paypal rest API add discount on the total amount

Tagged Under :

On Paypal rest APi, it don’t have a specifies discount function for the payment. And you are not allow minus the discount price from the total amount, because Paypal itself will add all the items total price when you submit. If the total price are different with the amount you set. It will return an error for you.

The simple way to set the discount price in Paypal APi. you can set the discount as an item. For example to set the discount.
$item3 = new Item();
$item3->setName('Voucher Discount')
    ->setDescription('Voucher Discount')
    ->setCurrency('USD')
    ->setQuantity(1)
    ->setPrice('-10');
Remember you must set the price as ‘-10’ no -10. If the latter, it will become 0 and then the total items prices will different with the Total amount you set inside the Transaction. Once it different Paypal will return an error for you.

March 10 2015

Joomla Page refresh function

Tagged Under :

Joomla
I have do the research with google and found that. Joomla itself don’t have refresh function for their application. But if I need do the refresh function with my component or module then how?

IN here, I found a simple way to let my application do the refresh with below code. and it work find in my component and module with Joomla 2.5.
$app = JFactory::getApplication();
$app->redirect(JUri::getInstance());

February 04 2015

Jquery simple dynamic dropdown options with PHP array

Tagged Under : ,

jquery
Dynamic dropdown options always use in our Application. It can be based on user first selection to return a new listing to second dropdown options by AJAX.

Below is the example PHP array script:
$option = array();
$option[] = array('name' => 'fruits', 'value' => 'f');
$option[] = array('name' => 'vegetables', 'value' => 'v');
$option[] = array('name' => 'pizza', 'value' => 'p');

And now we need the Jquery script to build the dropdown select. Below script are allow to reuse again when you need to replace the dropdown option again.

January 11 2015

Custom HTML Upload Button with CSS

Tagged Under :

css3
To change the HTML Upload Button css we need to create a new label for it. and then hide the current upload button.

The label is use for to let the user upload the file. But you still need to prepare the upload button inside your code. But it already hidden in interface.

<label for="uploadBtn">Choose File...</label>
<input type="file" id="uploadBtn">
<span id="filename"></span>
But before that, please make sure the label for name must same with the upload button id. So when the user click the label, it will pop up to select the file.

Below is the DEMO to show how it work:
Custom HTML Upload Button with CSS