calculation

Calculated Column Formula

Goal: Translating the functionality of a formula that works in Excel, into something I can use in a calculated column in SharePoint. Alternate Goal: A completely different solution from the one I'm currently trying to make work. Scenario: Running MOSS 2007, I have a list with a text column populated with multiple dates (in text forma...

When is it appropriate to use floating precision data types?

It's clear that one shouldn't use floating precision when working with, say, monetary amounts since the variation in precision leads to inaccuracies when doing calculations with that amount. That said, what are use cases when that is acceptable? And, what are the general principles one should have in mind when deciding? ...

How to implement a reputation system like Stack Overflow?

I've been looking into implementing a Stackoverflow-like site (for a completely different area of knowledge) for a little bit now, and I have a question on what people think is the best way to implement reputation for a system like this. Of course, that's a broad topic, so here are some specific questions that I have: Calculation of R...

Traceable/documented calculations

We are about to redesign our calculation engine, and want each step in the calculation to be traceable/documented so that the user can get a complete report on what amounts make up each total. Are there any patterns or good examples on how to implement 'traceable' or 'self-documenting' calculations? ...

What is the inverse of bitwise AND in C#?

I need to do an inverse calculation, which consists bitwise AND operation,how do I do it? I tried exclusive OR, but it didn't help. int i = 254 & 2; Console.Write("254 & 2 ={0}", i + "\n"); Console.Write("{0} ^ 2 ={1}",i, (i ^ 2) + "\n"); Doesn't work. How do I do that calculation? ...

What's the best way to calculate remaining download time?

Let's say you want to calculate the remaining download time, and you have all the information needed, that is: File size, dl'ed size, size left, time elapsed, momentary dl speed, etc'. How would you calculate the remaining dl time? Ofcourse, the straightforward way would be either: size left/momentary dl speed, or: (time elapsed/dl'ed s...

How to find the next august? C#

I have the following problem: We need to find the next august. I other words if we are 2009-09-01 we need 2010-08-31 if we are 2009-06-21 we need 2009-08-31. I know I can check if today is smaller than august 31 but I was wondering if there is an other possibility. ...

Displaying multiple totals in one table from Oracle

I am trying to calculate the total rows in a table called DRAWING with the following query: Select field, platform, count(doc_id) as total from drawing group by field, platform; but I also need to display the total of attachments/non-attachments for each platform SQL: select field,platform,count(doc_id) as attached from drawing where ...

Calculate text height based on available width and font?

We are creating PDF documents on the fly from the database using PDFsharp. I need to know the best way to calculate the height of the text area based on the font used and the available width. I need to know the height so I can process page breaks when required. ...

Divide problem

Hello, I was very surprised when I found out my code wasn't working so I created a console application to see where the problem lies and I've got even more surprised when I saw the code below returns 0 static void Main(string[] args) { float test = 140 / 1058; Console.WriteLine(test); Console.ReadLine();...

How to turn hexadecimal into decimal using brain?

Hello, Opening the calculator to do such tiny stuff appears annoying to me ,and I strongly believe in ths saying "the more you know,the better!" so here I am asking you how to convert hexadecimal to decimal. Till that moment I use the following formula: Hex: Decimal: 12 12+6 22 22+2*6 34 34+3*6 49 ...

Sum and calculations for each customer in SQL stored procedure

Hi all, In a SQL database I got storage information for each user, for each customer. I need to write a stored procedure that sums the disc usage (MB) for the customers users. When I got the total sum of all users for a single customer (totalDiscUsage), I need to perform a calculation (simple example): x = numberOfUsers * 200 y = (tot...

Determining “System Load”

Does anyone know an elegant way to determine “System Load” preferably using Windows performance counters? In this case I mean “System Load” in the classical (UNIX) sense of the term and not in the commonly confused “CPU Utilization” percentage. Based on my reading … “System Load” is typically represented as a float, defining the numb...

How to calculate scores?

Hi, This question is more related to logic than any programming language. If the question is not apt for the forum please do let me know and I will delete this. I have to write a logic to calculate scores for blogs for a Blog Award website. A blog may be nominated for multiple award categories and is peer-reviewed or rated by a Jury on ...

[CSS] Layer doesn't stretch to height of containing image

See http://www.martenminkema.nl The layers of each entry only gain the height of the text that it contains. The height of the image isn't taken into account, resulting into troubles with some layout markup in some cases. html: <div id="entry-296" class="hentry entry gedachten"> <a href="http://www.martenminkema.nl/gedachten/2009/06/au...

(Rails, ActiveRecord) How do I use ActiveRecord calculations while still retrieving field names?

Hi All, Is there any way to use ActiveRecord calculations while also acquiring relevant field names? For example, I'd like to find the average age of all people with the various last names. Basically I'd like to use: Person.average(:age, :group_by => "last_name") ... as a substitute for "Select last_name, AVG(age) FROM Peopl...

Can one know how large a factorial would be before calculating it?

I'm using GMP to calculate very large factorials (e.g. 234234!). Is there any way of knowing, before one does the calculation, how many digits long the result will (or might) be? ...

Problem with JQuery Calculation Plugin

I'm not able to get this to work at all. Getting not defined for all of the available functions. Everything is loaded correctly too. Here is the link to the example. Thanks, Mike ...

c# calulcation logic

hi, i am looking to put together some logic to look at a particular number and based on a simple calulcation tell me what another number is. Example - lets say that i have a string of characters and each 50 characters will increment an integer by 1. so if i have 0 - 49 chars, counter = 1, if i have 50-99 chars, counter = 2, if i have 100...

Open Source Financial Library Specifically Yield To Maturity

Does anyone know of an open source financial library that implements Yield To Maturity and other fixed income calculations? The library needs to be callable from .Net. ...