If I have this little function:
<script type="text/javascript">
function printFloat(){
var myFloatNumber1 = document.getElementById('floatNumber1');
var myFloatNumber2 = document.getElementById('floatNumber2');
alert(parseFloat(myFloatNumber1.value) + parseFloat(myFloatNumber2.value))
}
</script>
<input type="text...
Hello all
I have the following LINQ conditional where clause query that produces a result of weights:
From this, I'd like to take the result set and join on another table, tblPurchases
var result = weights.Join(getsuppliersproducts.tblPurchases,
w => new { w.MemberId, w.MemberName, w.LocationId, w.UnitId },
p => new { p.M...
( [0] => Array
( [0] => Array (
[0] => Array ( [price] => 76 )
[1] => Array ( [price] => 200 )
[2] => Array ( [price] => 500 )
[3] => Array ( [price] => 67 )
is there a clean way to calculate all these prices
...
Hi, i have trouble with following sql-statement (trimmed):
SELECT nr,
(CASE WHEN
SUM(vkdtab.amount*liter)<>0 AND
jjjjmm BETWEEN 201001 and 201009
THEN SUM(net)/SUM(vkdtab.amount*liter)
ELSE 0 END) as return
FROM tab
GROUP BY 1,2,3
It should give me the amount/liter of items in a special timeframe, but I...
I have the following query
SELECT tagindex, AVG(val) from floatTable
WHERE tagindex IN(828,856,883,910)
AND DateAndTime > DATEADD(HH,-1,GETDATE())
AND DateAndTime < DATEADD(HH,-2,GETDATE())
group by tagindex
It returns the following:
828 1
856 1
883 1
910 1
How can I return a single result where it is the combined a...
If data is in the following format:
SID TID Tdatetime QID QTotal
----------------------------------------
100 1 01/12/97 9:00AM 66 110
100 1 01/12/97 9:00AM 66 110
100 1 01/12/97 10:00AM 67 110
100 2 01/19/97 9:00AM 66 .
100 2 01/19/97 9:00AM 66 110
100 2 01/19/97 10:00A...
I have 2 tables in my database: item and category.
Items can be active, or inactive, and have a categoryID that relates to the id of a record in the category table.
i want to perform a query to show all the categories, with the total cost of active items for the category
So my goal is to return something looking like this:
+------...
I have the following XML:
<root>
<groups>
<group id="101">
<number>10</number>
<children>
<leader id = "A" />
<members>
<member id="1">
<member id="2">
<member id="3">
</members>
</children>
</group>
<group id="102">
<number>20</number>
<children>
<leader id = "A" />
<members>...
Not a SQL guy, so i'm in a bind, so I'll keep this simple
+--------------+------------------------+
| RepaymentDay | MonthlyRepaymentAmount |
+--------------+------------------------+
| 3 | 0.214847 |
| 26 | 0.219357 |
| 24 | 0.224337 |
| 5 | ...
class Class1
{
[STAThread]
static void Main(string[] args)
{
int lap, avg = 0;
double time = 0;
Random generator = new Random();
time = generator.Next(5, 10);
for (lap = 1; lap <= 10; lap++)
{
time = (generator.NextDouble())* 10 + 1;
Console.WriteLine("Lap {0} with a lap time of {1} seconds!!!!"la...
Hi,
I have a table with columns like these :
idx | amount | usercol1 | usercol2 | usercol3 | percentage1 | percentage2 | percentage3
Data is typically like this :
0 | 1500 | 1 | null | null | 100 | null | null
1 | 3000 | 2 | 3 | null | 50 | 50 | null
I would...
Is there any formula for this series? I think it is a harmonic number in a form of sum(1/k) for k = 1 to n
...
Say I want something like this in Rails:
class Proposal < ActiveRecord::Base
def interest_level
self.yes_votes.count - self.no_votes.count
end
private
def yes_votes
self.votes.where(:vote => true)
end
def no_votes
self.votes.where(:vote => false)
end
end
What have I basically done w...
Is there a more idiomatic way to sum strings in Python than by using a loop?
length = 0
for string in strings:
length += len(string)
I tried sum(), but it only works for integers:
>>> sum('abc', 'de')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: sum() can't sum strings [use ''.join(seq) inst...
I've got two SQL Server 2005 tables: MainTable and Orders.
MainTable:
| MainID | Serial |
-------------------
| 1 | A00001 |
| 2 | B00002 |
Orders:
| OrderID | MainID | Name | Value |
-----------------------------------
| 1 | 2 | John | 100 |
| 2 | 2 | Mike | 200 |
| 3 | 1 | John | 150 ...
Hi, I have a table like this one:
SELECT value FROM table;
value
1
3
13
1
5
I would like to add an accumulator column, so that I have this result:
value accumulated
1 1
3 4
13 17
1 18
5 23
How can I do this? What's the real name of what I want to do? Thanks
...
hi again every one
i would like to ask something about query using mysql
i have this table called video_stat, and here's the field
CREATE TABLE IF NOT EXISTS `video_stat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`video_id` int(10) NOT NULL,
`member_id` int(10) NOT NULL,
`counter` int(11) NOT NULL,
`daydate` varchar(15) NOT NU...
I have a table 'TableA':
TableA_ID (int)
Date (smalldatetime)
Name (string)
and a table 'TableB' linked with TableA by TableA_ID:
TableB_ID (int)
TableA_ID (int)
Description (string)
Total (double)
I want to sum up the TableB 'Total' column between two dates (TableA 'Date').
...
hi,
does anyone know a good and efficient algorithm for equal k subsets algorithm ? preferably c or c++ which could handle a 100 element vector maybe with a complexity and time estimation
ex. 9 element vector
x = {2,4,5,6,8,9,11,13,14}
i need to generate all k=3 disjoint subsets with sum = 24
the algorithm should check if there are ...
I have a workbook with two spreadsheets. One is 'Daily Profit and Loss' and looks like this:
Date | Profit
01/01/01 | £1
01/02/02 | £-1
And another is 'Weekly Profit and Loss'
Week Beginning | Profit
...
How can I get the sum profit per week in the 'Weekly Profit and Loss' spreadsheet?
Cheers,
Pete
...