About phptuts

Author Archive | phptuts

How to protect password a folder in Nginx

Example: we need protect folder /home/nginx/domains/tutorialspots.com/public/secure with a username and password. Step 1: login server via SSH Step 2: create file .htpasswd eg: /home/nginx/domains/tutorialspots.com/public/secure/.htpasswd you can replace username with your name login eg: admin Then you will see: Example result: You will get file .htaccess with content like: You can use this command to generate […]

Read full story Comments { 0 }

JS: Calculate Distance Between Two Coordinates

This routine calculates the distance between two points (given the latitude/longitude of those points). It is being used to calculate the distance between two locations: Example: Result: 423232.8593012345 Note: Result as meters Ellipsoidal parameters: Name Major axis, a (km) Flattening (f) WGS84 6378.13700 1/298.257223563 GRS80/NAD83 6378.13700 1/298.257222101 WGS66 6378.145 1/298.25 GRS67/IAU68 6378.16000 1/298.2472 WGS72 6378.135 […]

Read full story Comments { 0 }

How to detect WebView Android and UIWebView IOS

Read first: Example User Agent Strings mobile How to detect WebView Android We see that, WebView user-agent string contains string Version, we do a test: Result: Other test: Result: So, we have method: How to detect UIWebView IOS Example: Result: Update:

Read full story Comments { 0 }

Example User Agent Strings mobile

User Agent Strings A browser’s user agent string (UA) helps identify which browser is being used, what version, and on which operating system. When feature detection APIs are not available, use the UA to customize behavior or content to specific browser versions. Like all other browsers, Chrome for Android sends this information in the User-Agent […]

Read full story Comments { 0 }

Cordova lesson 7: Test the App

Test the App SDKs for mobile platforms often come bundled with emulators that execute a device image, so that you can launch the app from the home screen and see how it interacts with many platform features. Run a command such as the following to rebuild the app and view it within a specific platform’s […]

Read full story Comments { 0 }

Cordova lesson 6: Build the App

Build the App By default, cordova create script generates a skeletal web-based application whose start page is the project’s www/index.html file. Any initialization should be specified as part of the deviceready event handler defined in www/js/index.js. Run the following command to build the project for all platforms: $ cordova build You can optionally limit the […]

Read full story Comments { 0 }

Cordova: how to fix error: The connection to the server was unsuccessful. (file:///android_assets/www/index.html)

how to fix error: The connection to the server was unsuccessful. (file:///android_assets/www/index.html) ??? There are three methods: Method 1: open file config.xml and add this line: Rebuild app, now success. Method 2: open file config.xml and add these lines Method 3: 3.1 Rename your index.html to “main.html” 3.2 Create a new “index.html” and put the […]

Read full story Comments { 0 }

Cordova lesson 5: Add Plugins

You can modify the default generated app to take advantage of standard web technologies, but for the app to access device-level features, you need to add plugins. A plugin exposes a Javascript API for native SDK functionality. Plugins are typically hosted on npm and you can search for them on the plugin search page. Some […]

Read full story Comments { 0 }

Cordova lesson 4: Install pre-requisites for building

To build and run apps, you need to install SDKs for each platform you wish to target. Alternatively, if you are using browser for development you can use browser platform which does not require any platform SDKs. To check if you satisfy requirements for building the platform: $ cordova requirements Requirements check results for android: […]

Read full story Comments { 0 }

Cordova lesson 3: Add Platforms

All subsequent commands need to be run within the project’s directory, or any subdirectories: $ cd hello Add the platforms that you want to target your app. We will add the ‘ios’ and ‘android’ platform and ensure they get saved to config.xml and package.json: $ cordova platform add ios $ cordova platform add android Result: […]

Read full story Comments { 0 }