calculation

Determine position in front of 3D plane (cartesian math)

Hi there, I have a planar element in 3D space that I've rotated on the x, y and z axis. I'm positioning a 3D camera in front of the planar but I need to find a way to calculate the x, y, z of the camera. I'm trying to figure out how to place the camera at x distance from the planes face. There's obviously a bit of trig involved but for...

iphone: Calculating battery life

Wondering if there are references beyond the Apple tech stats for calculating battery life. I've tried comparing some existing battery apps (battery % left * Apple's figures) and I dont come up with the same answers sometimes. Also there are stats for using 2G cell (as opposed to 3G) and I dont see anything on Apple for 2G battery life. ...

How to calculate the IP range when the IP address and the netmask is given?

When a IP-Range is written as aaa.bbb.ccc.ddd/ I need to calculate the first and the last included ip address in this range with C#. Example: Input: 192.168.0.1/25 Result: 192.168.0.1 - 192.168.0.126 ...

Math calculation with decimal isn't correct

I have a C# method and which accepts three string parameters. After converting them to decimal, I am trying to perform a simple math calculation. I don't understand, why isn't the result correct? decimal d = MyFunction(x, y, z); public decimal MyFunction(string x, string y, string z) { decimal dx = 0; decimal dy = 0; decim...

iPhone dev - NSTimer accuracy for time instead of recalculating?

I have a little project that is a timer that counts down 'til midnight, and I was wondering If I should leave it as it is, calculating the time until midnight each second (inside NSTimer method that gets called every 1 second): NSDate *now = [[NSDate alloc] init]; NSDateComponents *dateComponents = [[self gregorian] components: (NS...

Calculate minutes until specific time? (C)

What's the simplest way to calculate the number of minutes until 9pm (being today or tomorrow)? Was looking over mktime() but seemed a hassle to get the day # and month, dealing with all that. ...

Wrong results in JavaScript table

Hi, I'm trying to create a matrix for 12-tone music. The numbers between 0-11 show the intervals between pitches. My script shows the matrix correctly as it runs initially with the page; but when we do another calculation with the button, it goes messy, even with the same pitch set. Here is my script: var exist = 0; function ex...

What's the standard approach to making calculations thread-safe?

What initially seemed like a problem with an easy solution has proven to be quite an interesting challenge. I have a class which maintains an internally fixed-size, thread-safe collection (by way of using lock on all insertion and removal operations) and provides various statistical values via its properties. One example: public doubl...

How can I represent a formula in a way that is understood by both Javascript and PHP?

I'm writing a shopping cart in PHP, and part of its function is to calculate shipping for a given set of products. For users with Javascript enabled, I want to provide the smoothest experience possible by having an accurate shipping calculation done on the client side so that changes in the cart do not require page reloads or AJAX calls....

Handling temporary calculation in Linq

When solving an interview question Question A six digit number need to be found in such a manner when it is multiplied by an integer between 2 and 9 gives the original six digit number when its digits are reversed. Example: Suppose I multiply 219978 * 4 i get 879912 ,when reverse 879912 I will get 219978 back. I solved it us...

mysql load testing tools

Hi All, I want to calculate the each row size of a table. are there any tools available for this. Also Does anyone aware of any load testing tools. Thanks in advance. Regards, Manasi ...

Actionscript to c#

How to write this in C#.NET, I have not been encountered using the ^ or & var reg_1 = 234 ^ (8393 & 1); ...

ASP.NET Application – Making a Time Estimate

Hi, We are building an ASP.NET application. Here I need to make time estimate for the entire application. At present I am using my past experience and some thumb rules to arrive to a rough estimate. So now my doubt is that do people use past experience and few thumb rules to make it or use some common methodologies/practices such a...

Flex: Calculate hours between 2 times?

I am building a scheduling system. The current system is just using excel, and they type in times like 9:3-5 (meaning 9:30am-5pm). I haven't set up the format for how these times are going to be stored yet, I think I may have to use military time in order to be able to calculate the hours, but I would like to avoid that if possible. But ...

Average Size of an RSS/Feed file, for Data Storage and Bandwidth Calculation

Hi Folks, Doing a back of the envelope calculation to determine network bandwidth and data storage needed to monitor approx 10,00,000 feeds every 20 minutes. Any idea what could be the average size of an rss file ? I remember reading somewhere the guys from technorati revealing the avg size of an rss file. Ankur Gupta ...

Time calculation in php (add 10 hours)?

I get the time: $today = time(); $date = date('h:i:s A', strtotime($today)); if the current time is "1:00:00 am", how do i add 10 more hours to become 11:00:00 am?? ...

Statistics Question

Suppose I conduct a survey of 10 people asking whether to rank a movie as 0 to 4 stars. Allowable answers are 0, 1, 2, 3, and 4. The mean is 2.0 stars. How do I calculate the certainty (or uncertainty) about this 2.0 star rating? Ideally, I would like a number between 0 and 1, where 0 represents complete uncertainty and 1 represents ...

Are data-snapshots of line item prices better than calculations in all cases?

I've often seen line_item tables for orders or invoices that copy one or more fields from other tables in order to take a snap-shot of a customer's product order when it was placed. In my schema, however, I can generate a view of an order without copying data. So looking up the order/product/price data is a little more expensive, but I...

How are CouchDB Document ID's Calculated?

How are the CouchDB Document ID's calculated? BA1F48C5418E4E68E5183D5BD1F06476 Thanks! ...

MDX Calculated Member

I am trying to create a TFS report which requires MDX. I am making a report that requires a calculated member. I am not 100% sure how this is done. The member i am trying to do is a difference calculation. For example: Table Sept 1 Sept 2 Sept 3 Actual 0 32 58 Remaining 163 140 ...