loading
Please wait while loading...

Read more sql-mode-caused-error

Sometimes we may got some sql error like belows:

- Field doesn't have a default values
- Incorrect integer value: '' for column

These because your MySQL server runing strict mode, if you don't want to change your sql statement, a simple solution is switch off the strict mode

find my.ini or my.cnf, add the following line to the end of the file and restart the service (for cPanel , the path may be /etc/ my.cnf)

sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Read more Phonegap change Android App title bar

Usage in phonegap build:

Put the following two line in config.xml

<preference name="HeaderColor" value="#becb29" />
<plugin name="cordova-plugin-headercolor" version="1" />

 

...........

Read more HTML5 Link Prefetch Tag

HTML5 added a prefetch function to allow you preload a web page or source (image, video, everything...).
The prefetch api uses a link tag and with rel attribute set to 'prefetch'.

<link href="http://yourdomain.com/nextpage" rel="prefetch" />

Read more PHP Geo

A nice library to calculate geographical distances for PHP.

example code:

use Location\Coordinate;
use Location\Distance\Haversine;

$coordinate1 = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
$coordinate2 = new Coordinate(20.709722, -156.253333); // Haleakala Summit

echo $coordinate1->getDistance($coordinate2, new Haversine()); // returns 128384.515 (meters; ≈128 kilometers)
...........

Read more Prettify mobile view of pretty photo

I got the issue that pretty photo shows photos too small on mobile device, I think the problem just caused by the calculating of the resizing, so I try to find the snippet of the resize function from the js source and that was easily got the solution as below:

I am using the 3.1.6 version, please find the function _fitToViewport in line 568. Then scroll down some more you will see imageWidth = (windowWidth - 200); and imageHeight = (windowHeight - 200);

Just reduce the number and then the mobile view will become very nice!! I try to adjust many times and got the best fit number is 38 and 100. You can just copy the following code to replace the original one:

if(pp_containerWidth > windowWidth - 38){
    imageWidth = (windowWidth - 38);
    imageHeight = (height/width) * imageWidth;
} else if(pp_containerHeight > windowHeight - 100) {
    imageHeight = (windowHeight - 100);
    imageWidth = (width/height) * imageHeight;
} else {
    fitting = true;
};

 

1 2 3 4 5 6 7 8 9 10