» Home » Calculating » Page 1
Calculating multiline text height for UILabel/UITableViewCell: different results when calculating vs actual drawing
by Longchao Dong in Mobile Programming

This general topic has been asked here multiple times: how to render UITableViewCells with varying amount of text and thus varying height. The canonical answer is: you calculate the height in table view controller delegate in heightForRowAtIndexPath using sizeWithFont:constrainedToSize:lineBreakMode:. Later, the cell gets drawn, and you use something like [label sizeToFit] if needed, and all wo

Is there any advantage to calculating the duration in MySQL as opposed to calculating duration in PHP (and then storing in MySQL)?
by John Studdert in PHP

QUESTION: Is there any advantage to calculating the duration in MySQL as opposed to calculating duration in PHP (and then storing in MySQL)?

I had intended on calculating duration for each time an activity is done. Duration would be calculated in PHP then inserted into a MySQL DB (along with other data such as start time, end time, user, activity, etc).

But, based on thi

Calculating phi(k) for 1<k<N
by FlyOnTheWall43 in Development Tools & Services

Given a large N, I need to iterate through all phi(k) such that 1 < k < N quickly. Since the values of N will be around 1012, it is important that the memory complexity is sub O(n).

Is it possible? If so, how?

TAGS : Calculating

calculating gpa sql
by Israel in Databases

to calculate SGPA of a students in table the formula is sum of 3*gradepoint of every course registered by a specific student in specific semester and dividing this sum by no.of courses.

i am having a table named All_Registration having fields and data as followed

TAGS : calculating

Calculating with PHP
by orneka in PHP

I am unable to calculate a cubic meter with PHP using the following syntax-

$value = $data["Cm-Length"]*$data["Cm-Depth"]*$data["Cm-Height"]/1000000

In the same table I can successfully calculate the cubic feet of the same item using the following syntax-

$value = $data["Inches-Length"]*$data["Inches-Depth"]*$data["Inches-Height"]/1728
TAGS : Calculating with

Calculating the sum in C++
by George in C & C++ & C#

How do I calculate the sum to below in C++?
I tried the following code but failed.

#include <iostream>
using namespace std;
int main()
int n, p, r = -1;
cin >> n;
for (p = 0; p < 10; p++)
r *= (-1);
cout << r << endl;
return 0;
TAGS : Calculating

Calculating CRC example
by Ian McKellar in Coding

Could someone please show me the steps in calculating this CRC code?
Generator polynomial G(x)=10
message with crc appended: 110

When the data is divided by G(x) then the remainder is 0. So do that mean the CRC is 0 or nothing or is that even possible?

R: Calculating MSE
by Pottuvoi in Web Design

I've got a function, I've added noise to it, then smoothed it to get a regression line. How can I find the MSE between the original function and the regression line at 30 equally spaced points?

Or, how can I give R an x value and get the y value on a regression line?

This is a scaled down version of my problem:

> test<- function(m) {3*m^2+7*m+2}
TAGS : Calculating

Calculating a Sum with C++
by mitry in C & C++ & C#

I wrote the following code to sum the series (-1)^i*(i/(i+1)). But when I run it I get -1 for any value of n.

Can some one please point out what I am doing wrong? Thank you in advance!

#include <iostream>
using namespace std;
int main()
int sum = 0;
int i = 1.0;
int n = 5.0;
TAGS : Calculating with

Calculating pi in pthreads
by Seba in Programming Languages

I am trying to calculate pi using the bpp method but my result keeps coming up at 0.The whole idea is for each thread to compute a part of it and the sum of each thread gets summed up using the join method

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <time.h>
#define NUM_THREADS 20
void *pi_function(void

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .