Robert Kern
PHP Web Developer
My name is Robert Kern.
I am a PHP developer from Auckland, New Zealand.
Browse through some of my web development projects, or get in contact with me if you are interested in hiring my php web development services.

Search

  • Topics

    • Honduras (25)
    • Hosting (3)
    • How to (9)
    • iphone (11)
    • Mac (8)
    • Movies (1)
    • Off Topic (10)
    • PHP (8)
    • Recipes App (12)
    • Servers (1)
    • Software (8)
    • Subversion (4)
    • Technology (4)
    • Uncategorized (1)
    • Videos (8)
    • Web Development (19)
      • Security (2)

 

Archives

  • March 2010
  • December 2009
  • November 2009
  • October 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • July 2007
  • Home
  • Web development
  • PHP
  • Projects
  • Contact me
...
  • In Honduras

Move data from one web server to another using wget

Recently I needed to move a large amount of data from one web server to another. I was moving about 50 websites to a new server. I didnt want to download all the data via FTP and then upload it to the new server (especially not from here in Honduras where the Internet isnt as fast as I would have liked). I didnt have SSH access to the old server due to shared hosting security issues. How did I move it all in only a few minutes?
Read the rest of this entry »

Tags: MySQL, PHP, wget
August 29th, 2008 | Posted in Hosting | 2 Comments »

Finding objects close to a location with MySQL

For a project I’m currently working on, I needed to be able to find people that a within a certain distance from a particular point.

I have a large database of people that each have a Longitude and Latitude of their location. One of the searches in the app I am building needs to find people that are close to the location of the Job. So if the Job is in Kumeu (NZ), I want to see the people that are close (lets say 25km).

This is made easy with the Haversine formula. Google has a good article that gives a MySQL query that will produce a list of rows from the database where the locations are within a certain number of kilometres/miles.

The MySQL query looks like this:

SELECT *,
(6371 *
acos(cos(radians(174.556107)) * cos(radians(latitude))
* cos(radians(longitude) - radians(-36.775700))
+ sin(radians(174.556107)) * sin(radians(latitude))))
AS distance
FROM Locations
HAVING distance < 25
ORDER BY distance

The location in the example above (-36.775700, 174.556107) is of Kumeu (NZ). The table currently has 4,500 records and the query takes about 0.0063 seconds (actually it is usually 0.0001 seconds).

Note that the above query calculates kilometres. If you are wanting miles, change the figure of 6371 to 3959.

The HAVING distance < 25 means that we are only getting the records who are within 25km of the original location.

Tags: Google, MySQL, PHP
May 7th, 2008 | Posted in How to, Web Development | No Comments »

© 2004-2010 Robert Kern, owner of Frondiz, need Hosted Subversion? | Design by Jarred Bishop | WordPress