<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Robert Kern &#187; MySQL</title> <atom:link href="http://www.robertkern.com/tags/mysql/feed" rel="self" type="application/rss+xml" /><link>http://www.robertkern.com</link> <description>PHP Web developer</description> <lastBuildDate>Fri, 03 Feb 2012 01:29:54 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <cloud
domain='www.robertkern.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' /> <item><title>Move data from one web server to another using wget</title><link>http://www.robertkern.com/hosting/move-data-from-one-web-server-to-another-using-wget.html</link> <comments>http://www.robertkern.com/hosting/move-data-from-one-web-server-to-another-using-wget.html#comments</comments> <pubDate>Thu, 28 Aug 2008 16:00:01 +0000</pubDate> <dc:creator>Robert Kern</dc:creator> <category><![CDATA[Hosting]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[wget]]></category><guid
isPermaLink="false">http://www.robertkern.com/?p=147</guid> <description><![CDATA[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 [...]]]></description> <content:encoded><![CDATA[<p>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?<br
/> <span
id="more-147"></span><br
/> I had asked the host for a backup of my home directory which contained the data for all the sites.  Due to some annoying permissions problems, the backup they provided me didnt contain all the files (which I discovered as I begun doing the scheduled transfer).  The timezone differences meant that while I was working at a comfortable 8am, the time in NZ was around 2am.  I couldnt ask for another backup and expect to have it in time, so I had to think of a better way.<br
/> Then I remembered wget.  An amazing Unix tool that I use very often.  I usually only use it for http requests, and had forgotten it could do ftp as well.  So while I didnt have SSH access to the old server, I did have FTP access.  I used the following wget command to log into FTP and download every single file under my home directory to the new server (which I did have SSH access to as it is a VPS that I own):</p><p><strong>wget -r -N -l inf ftp://user:pwd@ftp.example.com/foldername</strong></p><p>Within a few minutes (the two servers were both based in Auckland and the transfer speed was incredibly fast) all the data had been transferred across.  I only had to re-organise the location of the data to the appropriate places, backup and import the MySQL databases to the new server and wa-la it was done.  Thankfully, the 50-odd sites are running on the Frondiz CMS which means that the installation on the new server was very quick (ie, I didnt have to setup 50 different sites in apache, just a few, one that contains lots of domain names).</p> ]]></content:encoded> <wfw:commentRss>http://www.robertkern.com/hosting/move-data-from-one-web-server-to-another-using-wget.html/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Finding objects close to a location with MySQL</title><link>http://www.robertkern.com/web-development/finding-objects-close-to-a-location-with-mysql.html</link> <comments>http://www.robertkern.com/web-development/finding-objects-close-to-a-location-with-mysql.html#comments</comments> <pubDate>Wed, 07 May 2008 01:38:10 +0000</pubDate> <dc:creator>Robert Kern</dc:creator> <category><![CDATA[How to]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category><guid
isPermaLink="false">http://www.robertkern.com/?p=65</guid> <description><![CDATA[For a project I&#8217;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 [...]]]></description> <content:encoded><![CDATA[<p>For a project I&#8217;m currently working on, I needed to be able to find people that a within a certain distance from a particular point.</p><p>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).</p><p>This is made easy with the <a
href="http://en.wikipedia.org/wiki/Haversine_formula" target="_blank">Haversine</a> formula.  Google has a <a
href="http://code.google.com/support/bin/answer.py?answer=87134&amp;topic=11364" target="_blank">good article</a> 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.</p><p>The MySQL query looks like this:<br
/> <code><br
/> SELECT *,<br
/> (6371 *<br
/> acos(cos(radians(174.556107)) * cos(radians(latitude))<br
/> * cos(radians(longitude) - radians(-36.775700))<br
/> + sin(radians(174.556107)) * sin(radians(latitude))))<br
/> AS distance<br
/> FROM Locations<br
/> HAVING distance &lt; 25<br
/> ORDER BY distance<br
/> </code><br
/> 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).</p><p>Note that the above query calculates kilometres.  If you are wanting miles, change the figure of 6371 to 3959.</p><p>The HAVING distance &lt; 25 means that we are only getting the records who are within 25km of the original location.</p> ]]></content:encoded> <wfw:commentRss>http://www.robertkern.com/web-development/finding-objects-close-to-a-location-with-mysql.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.robertkern.com @ 2012-02-04 15:30:11 -->
