About phptuts

Author Archive | phptuts

PHP: function strtoul

We know function strtoul in C++: converts the string into an unsigned long int according to the base of the number unsigned long int strtoul ( const char * str, char ** endptr, int base ); Convert string to unsigned long integer Parses the C string str interpreting its content as an integral number of […]

Read full story Comments { 0 }

PHP: How to extract string between 2 words

How to extract string between two words. How to parse a string between two strings. We offer 3 functions to obtain a string delimited between tags: Example: Result: tutorialspots.com | Free Online Tutorials | Tutorials, Resources and Snippets 6.31809234619E-5 tutorialspots.com | Free Online Tutorials | Tutorials, Resources and Snippets 9.01222229004E-5 tutorialspots.com | Free Online Tutorials […]

Read full story Comments { 0 }
PHP: How to determine the center of a Polygon

PHP: How to determine the center of a Polygon

How to determine the center of a Polygon. Read first: PHP: How to calculate signed area of a Polygon Method 1: Result: array(2) { [0]=> float(1.55555555556) [1]=> int(3) } Example 2: Result: array(2) { [0]=> int(0) [1]=> int(0) }

Read full story Comments { 0 }
PHP: How to check if polygon is concave or convex?

PHP: How to check if polygon is concave or convex?

How to check if polygon is concave or convex? Note: It is assumed that the polygon is simple (does not intersect itself or have holes) Example: Result: int(-1) The algorithm is built on base of the cross product of 2 vectors: We know that the cross product of 2 vectors: In the special case, 2 […]

Read full story Comments { 0 }
PHP: How to check if the vertices of polygon are in clockwise or counter-clockwise order?

PHP: How to check if the vertices of polygon are in clockwise or counter-clockwise order?

How to check if the vertices of polygon are in clockwise or counter-clockwise order? There are many of method to check this. We offer some method below: Method 1: Use ComputeArea function: Method 2: Note: It is assumed that the polygon is simple (does not intersect itself or have holes) Example: Result: int(-1)

Read full story Comments { 0 }
PHP: How to calculate signed area of a Polygon

PHP: How to calculate signed area of a Polygon

Calculating the signed area for an polygon can be found when you know the coordinates of the vertices. We offer 3 methods below: Method 1: Method 2: Method 3: Method 4: Note: If you list the points in a clockwise order instead of counterclockwise, you will get the negative of the area. Hence this can […]

Read full story Comments { 0 }
How to install mytop

How to install mytop

mytop is a ‘top’ clone for MySQL. mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of MySQL 3.22.x, 3.23.x, and 4.x servers. It runs on most Unix systems which have Perl, DBI, and Term::ReadKey installed. And with Term::ANSIColor installed you even get color. As of version 0.7, it even runs […]

Read full story Comments { 0 }

LXAdmin: Change the LXAdmin password

If you’ve forgotten your LXAdmin ‘admin’ password, you can change it by taking the following steps: 1. Connect to your VPS via ssh: Use Bitvise Tunnelier to login your VPS or dedicated server 2. Open new terminal console: 3. Run the following command. sh /script/resetpassword master newpassword Now you can use the new password to […]

Read full story Comments { 0 }
Google Maps JavaScript API v3: method Polygon.getBounds

Google Maps JavaScript API v3: method Polygon.getBounds

In Google Maps JavaScript API v2, Polygon had a getBounds() method, but that doesn’t exist for v3 Polygon. Here’s the solution: Here, we present a simplified method: Image copyright: Google maps

Read full story Comments { 0 }
Google Maps JavaScript API v3: method Polyline.getBounds

Google Maps JavaScript API v3: method Polyline.getBounds

In Google Maps JavaScript API v2, Polyline had a getBounds() method, but that doesn’t exist for v3 Polyline. I wrote some methods below: Method 1: Method 2: Method 3 is the shortest method. Image copyright: Google Maps

Read full story Comments { 0 }