calculation

Formula for producing a CGRect for a UIScrollView, that displays a UIImage in scaled to fit way

Hi I am loading in images with varying sizes and putting them in UIScrollViews, all the images are larger than the UIScrollView. The user can scroll and zoom as they please, but initially I would like for the image to be centered and scaled so the largest side of the image aligns with the edge of the scrollView, i.e. if the picture is i...

Calculations coming out to 0.0?

A simple percentage calculation. It wont return a value except 0.0 and I think once or twice it returned 100.0%. Other than that it won't do a thing. I have tried playing with the code in several different ways and it just wont work. for (int loop = 1; loop < loopCount; loop++) { aa = r.nextInt(10+1); ...

Java: Calculate distance between a large number of locations and performance

I'm creating an application that will tell a user how far away a large number of points are from their current position. Each point has a longitude and latitude. I've read over this article http://www.movable-type.co.uk/scripts/latlong.html and seen this post http://stackoverflow.com/questions/837872/calculate-distance-in-meters-when-...

PHP + Code Igniter Timecode Calculation Logic Error

Hello everyone, I have what I suspect to be a logic problem with an algorithm I am using to work with Video timecode in PHP. All help is appreciated. The Objective Well basically I want to work with timecode and perform calculations For those not familiar with timecode it looks like this 01:10:58:12 or HH:MM:SS:FF 'AKA' HOURS:MINU...

Can someone help explain how the css3 calc() method actually works?

http://www.w3.org/TR/css3-values/#calc I have been working on a library that converts some css3 methods into css2. One tricky part is math.. The proposal of css3's calc() method pretty much blew my mind.. I am able to add/subtract/divide/multiply pixels from ems or any other fixed unit, but I have no clue how you would add 10px to 60%...

Calculating annual percentage rate (need some help with inherited code)

I'm making an application that gives clients and approximate loan offer (they are later calculated by other back-office systems). I have received some code from the financial firm that we are making the calculator for. My problem is that I do not understand the part of the code that calculates the annual percentage rate (including start...

SQLite: How to calculate age from birth date

What is the best way to calculate the age in years from a birth date in sqlite3? ...

Javascript calculation bug

Hi, is there a better way to multiply and divide figures than using the * and / ? There is a strange behavior in Chrome Firefox and Internet Explorer using those operaters: x1 = 9999.8 x1 * 100 = 999979.9999999999 x1 * 100 / 100 = 9999.8 x1 / 100 = 99.99799999999999 http://jsbin.com/ekoye3/ I am trying to round down the user input ...

Filemaker: making queries of large data more efficient.

OK I have a Master Table of shipments, and a separate Charges table. There are millions of records in each, and it's come into Filemaker from a legacy system, so all the fields are defined as Text even though they may be Date, Number, etc. There's a date field in the charges table. I want to create a number field to represent just the y...

Capturing the executing time between 2 statements Java?

I want to capture the time take to go from statement A to Statement B in a Java class. In between these statements there are many web service calls made. I wanted to know if there is some stop watch like functionality in java that i could use to capture the exact time? Kaddy ...

calculating new gps coordinates given initial coordinate and *Small* range

Hi, I'm trying to figure out how to calculate a min/max lat/long bound on the specific given range of a gps coordinate. for example: gps coord 37.42935699924869,-122.16962099075317 range .2 miles I'm looking at the point + range + bearing in the http://www.movable-type.co.uk/scripts/latlong.html site but im not sure if this is exactl...

How to turn null to 0.

I built a little program that calculates the average of 15 numbers or less. There are 15 text-boxes, each one's default value is '0'. The program knows to get the sum of all typed numbers and divide it by numbers of text boxes that don't return '0'. But if the user deletes in mistake one of the '0'os in one of the text boxs.. run-time er...

jQuery calculation

Hello, I am new to jQuery and I would like to know how to accomplish a simple calculation based on the value selected in the picklist. please see the below screen shot I put on ImageShack for reference. I want to be able to show the result of the calculation in the text box at the right, If I enter number 2 on the text box on the left...

jquery calculation question.

Hi, I have this code: <div> <input id="number" type="text" /> <select id="Selection" name="D1"> <option>Plus 1</option> <option>Minus 1</option> </select> <input id="result" type="text" /> </div> How could I calculate any number entered into the input "number" based on the value chosen from the select ...

How to solve this equation?

Hi I am creating a web shop and have to calculate how much to charge the customer to make sure that the fees are cancelled. The payment system adds the fees and I want the customer to pay them. The fees are 2.45% and € 1.10. This means that if the customer shops for € 100, and I report that value to the payment system, we will only ge...

Simple variable calculation in ireport

I am new to ireport. How can I do simple calculations like adding subtracting multiplications and dividing two variables and storing the result in the third variable. The result of thrird variable is to be displayed in report. ...

jQuery: Count children of several elements and calculate

Hi there I'm making a website for a restaurant, where they want to make "room" in the menu, by starting the numbering with the following "5". Example: Starter 1. 2. Salads 5. 6. 7. 8. 9. 10. 11. Pizza 15. 17. I want to count the numbers of TABLEs within a DIV, give the tables this number, then count the number of TRs within the TAB...

how can form elements be summed seperately row by row column by column in jquery?

I have on-fly increasing form rows and 3 columns and each cell contains text box. I want to sum first 2 columns' values to 3rd colums for each row. how can i do that with jquery? let me visualize more: c1 c2 s r1 5 6 11 r2 7 3 10 . . . . s sc1 sc2 sc3 sc1,sc2,sc3 are sum of the related co...

PHP: How to calculate person age in months.

I have searched for this but did not find a perfect function in php. I want to get a php function that calculate person age only in months. For example: less then one month old. 5 months old. 340 months old. Thanks ...

How use to write programme that involve with a lot of active calculation? In excel 1M+ Row and 20+ column

First, I dont have any experience with programming. If I ever start, then this would be probably my first. I keep looking for answer until I found this site. I am looking outside the box because in excel doing a data of 1 million + row and 20 + column would take a very long time just to wait for the calculation to be done and the copy ...