Is the Haversine Formula or the Vincenty’s Formula better for calculating distance?

Haversine and Vincenty are two algorithms for solving different problems. Haversine computes the great circle distance on a sphere while Vincenty computes the shortest (geodesic) distance on the surface of an ellipsoid of revolution. So the answer to your question can be broken into 2 parts: Do you want to compute the distance on a … Read more

How do I explain what a “naive implementation” is? [closed]

I’d try to keep it away from computers altogether. Ask your audience how they find an entry in a dictionary. (A normal dictionary of word definitions.) The naive implementation is to start at the very beginning, and look at the first word. Oh, that’s not the word we’re looking for – look at the next … Read more

Data structure for storing recurring events?

There are various papers describing data structures and algorithms for this use case. In addition you can see the code or descriptions of open source implementation of crontab and of Quartz (Java) or Quartz.NET (.NET). This is one such paper http://portal.acm.org/citation.cfm?id=359763.359801&coll=ACM&dl=ACM&CFID=63647367&CFTOKEN=55814330 For example, cron stores the information like this (* means every, so a * … Read more

Are exceptions really for exceptional errors? [closed]

This sounds over-simplistic, but I think it makes sense to simply use exceptions where they are appropriate. In languages like Java and Python, exceptions are very common, especially in certain situations. Exceptions are appropriate for the type of error you want to bubble up through a code path and force the developer to explicitly catch. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)