bookmark_borderDistance of two Geo-Points in PHP & Python

I needed to calculate the distance between two Geo-Points using PHP.

Using Haversine formula you get to this function, where you enter lat1, long1, lat2, long2 and it will give the distance in Km.

In case you want to show the distance in Miles, simply change the Earth radius to 3956.

PHP:

Python

Hope it helps someone!

bookmark_borderOpen Hardware MoodLamp

Finally it’s here, my first Open Hardware project, in which I have delayed some years to release due my lack of time to finish it and make it presentable.

For this project I’ve created a Project Page, in which I will be updating in a regular basis.

So I want to invite you to take a look at the
OPEN HARDWARE MOODLAMP PROJECT PAGE.

bookmark_borderShowing your last “twit” using php

While editing my blog theme, I decided to add my last thoughts in twitter to the website. Came with a very simple php code that will get the information from the last twitter post and show it as a text line, so you can add in anywhere you want.

This is the code:

< ?php
preg_match('#(.*)#',file_get_contents('http://twitter.com/statuses/user_timeline/username.xml?count=1'), $matches);
echo $matches[0]
?>

Of course, remember to change username for your own.