Archiv:

Latest photoblog

photoblog

Blog » 2011 » August

Linkdump #5

5

A short test on performance when using IDs in CSS selectors:
http://oli.jp/2011/ids/

Nice trick: Fixing the JavaScript typeof operator
http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/

Understanding prototypes in JavaScript
http://yehudakatz.com/2011/08/12/understanding-prototypes-in-javascript/

How LinkedIn used Node.js and HTML5 to build a better, faster app
http://venturebeat.com/2011/08/16/linkedin-node/

Advantages of Most Perpetual Web Development Technologies – PHP, ASP.NET, Java, Ruby on Rails
http://phpwebdevelopmentservices.blogspot.com/2011/05/advantages-of-most-perpetual-web.html

10 Excellent HTML5 coding Tools Many Users Don’t Know About
http://smashinghub.com/excellent-html5-coding-tools.htm

Geolib.js

I created a small JavaScript library to provide some basic geo functions like distance calculation, conversion of decimal coordinates to sexagesimal and vice versa, etc.

Usage:

To calculate distance between two geo coordinates
geolib.getDistance({"latitude": 51.511928, "longitude": 7.463536}, {"latitude": 51.510318, "longitude": 7.524133}, 10); // -> 4200 (Accuracy 10m)

Takes 2 or 3. First 2 arguments must be an object with a latitude and a longitude property (e.g. {latitude: 52.518611, longitude: 13.408056}). Coordinates can be in sexagesimal or decimal format. 3rd argument is accuracy (in meters). So a calculated distance of 1248 meters with an accuracy of 100 is returned as 1200.

Return value is always an integer and represents the distance in meters.

To convert it into miles use:
geolib.convertUnit('mi', value)

Convert sexagesimal to decimal
geolib.sexagesimal2decimal("51° 29' 46\" N"); // -> 51.49611111

Convert decimal to sexagesimal
geolib.decimal2sexagesimal(51.49611111); // -> 51° 29' 46.00

Download:
https://github.com/manuelbieh/geolib

Demo:
http://www.manuel-bieh.de/publikationen/scripts/geolib/demo.html