Calculating Distance Between 2 Cities
How do you calculate the distance between 2 cities? ...
How do you calculate the distance between 2 cities? ...
I've developed an equation parser using a simple stack algorithm that will handle binary (+, -, |, &, *, /, etc) operators, unary (!) operators, and parenthesis. Using this method, however, leaves me with everything having the same precedence - it's evaluated left to right regardless of operator, although precedence can be enforced usin...
What is the best way to calculate Age using Flex? ...
I have an excel spreadsheet in a format similar to the following... | NAME | CLUB | STATUS | SCORE | | Fred | a | Gent | 145 | | Bert | a | Gent | 150 | | Harry | a | Gent | 195 | | Jim | a | Gent | 150 | | Clare | a | Lady | 99 | | Simon | a | Junior | 130 | | John | b | Junior | 130 ...
I need to sum points on each level earned by a tree of users. Level 1 is the sum of users' points of the users 1 level below the user. Level 2 is the Level 1 points of the users 2 levels below the user, etc... The calculation happens once a month on a non production server, no worries about performance. What would the SQL look like to ...
I am building a quiz and i need to calculate the total time taken to do the quiz. and i need to display the time taken in HH::MM::SS..any pointers? ...
I am interested in learning how dependency-based calculation engines work in practice. Of course, I can make up my own algorithm, but I was curious if there were any well explained algorithms that are used in practice. I have tried Google, but most articles are < "good". ...
If I have two dates (ex. '8/18/2008' and '9/26/2008') what is the best way to get the difference measured in days? ...
I have a tree of active record objects, something like: class Part < ActiveRecord::Base has_many :sub_parts, :class_name => "Part" def complicated_calculation if sub_parts.size > 0 return self.sub_parts.inject(0){ |sum, current| sum + current.complicated_calculation } else sleep(1) return rand(10000) e...
I have given a location defined by latitude and longitude. Now i want to calculate a bounding box within e.g. 10 kilometers of that point. The bounding box should be defined as latmin, lngmin and latmax, lngmax. I need this stuff in order to use the panoramio API: http://www.panoramio.com/api/ Does someone know the formula of how to g...
How to calculate the length (in pixels) of a string in Java? Preferable without using Swing. EDIT: I would like to draw the string using the drawString() in Java2D and use the length for word wrapping. ...
Repetitive Dates: Billing cycles come in a lot of different formats, for example: "the first of the month", "third Friday of the month", or "first weekday on or after 21st day after the 13th of the month" (thanks visa!). My goal is to be able to represent these different billing cycles in one easily parsed database text field. ...
Hey, i am simple cart page where it displays the content in table form and I am trying to find a way to add up the Cost column then display the total price at the bottom. Does anyone have any suggestions how to do that? The part that is confusing me is that it the table is dynamically created via ASP. My code can be found here: http://p...
I created the following code to calculate the duration between two timestamps which can come in two different formats: public class dummyTime { public static void main(String[] args) { try { convertDuration("2008-01-01 01:00 pm - 01:56 pm"); convertDuration("2008-01-01 8:30 pm - 2008-01-02 09:30 am"); } catch (Exception e) { e.p...
What's the fastest and easiest to read implementation of calculating the sum of digits? I.e. Given the number: 17463 = 1 + 7 + 4 + 6 + 3 = 21 ...
I want to calculate the average of a set of angles. For example, I might have several samples from the reading of a compass. The problem of course is how to deal with the wraparound. The same algorithm might be useful for a clockface. The actual question is more complicated - what do statistics mean on a sphere or in an algebraic space...
The digital sound is playing using DirectSound device. It is necessary to display sound activity in decibels - like analog devices do. What is the right way to calculate sound pressure from the WAVE PCM data (44100hz,16bit)? ...
I am writing a report to show gas usage (in gallons) used by each department. The request is to view each month and the gallons used by each department. A column is required to display what each departments target goal is, based on the gallons of gas they have used in a past time frame. Each departments target goal is x percent less than...
I have... Date start = new Date() ... ... ... Date stop = new Date() I'd like to get the years, months, days, hours, minutes and seconds ellapsed between these two dates. -- I'll refine the question. I just want to get the elapsed time, as an absolute measure, that is without taking into account leap years, the days of each mont...
I have a that looks like this: I, [2009-03-04T15:03:25.502546 #17925] INFO -- : [8541, 931, 0, 0] I, [2009-03-04T15:03:26.094855 #17925] INFO -- : [8545, 6678, 0, 0] I, [2009-03-04T15:03:26.353079 #17925] INFO -- : [5448, 1598, 185, 0] I, [2009-03-04T15:03:26.360148 #17925] INFO -- : [8555, 1747, 0, 0] I, [2009-03-04T15:03:26.367523...