Displaying 20 results from an estimated 100 matches similar to: "maths not working (can't get this)"
2008 Aug 31
6
why's my course_duration being reset
Can''t get this?...I''m close I think, my calculation appears to be
working, but.... when i access duration = <%= @enquiry.course_duration
%><br> in my final view it''s blank.. course_duration is getting set to
null but works for the calculation?
controller..
----------
class EnquiriesController < ApplicationController
  layout ''welcome''
2008 Feb 05
0
prices (where to store them and how)
trying to figure out the bet way to manage pricing in my app and
basically the database design.
It''s a language school that also offers host family accomodation.
They therefore have
Courses which have to have the following prices
fixed fees
----------
exam fee
reg fee
recurring fees
--------------
price_per_week (1 to 2 weeks)
price_per_week (3 to 4 weeks)
price_per_week (5 to 6
2006 Jun 06
4
pls help me regarding Maths round up function.....
Hi,
I have some values on my webpage displaying like
1.22333333333
2.33333344444
2.33377777777
etc.
Here I want to display values upto 2 decimal places correct.
i.e, 1.22333333333 should be dislayed as 1.22
     2.33333344444 should be dislayed as 2.33
     2.33777777777 should be dislayed as 2.34
& so on....
How to do this in ruby?????
Is there any function???
Thanx in advance.
Prash
-- 
2007 Jul 23
1
maths characters in labels & ylab padding
I have checked out the help files, but cannot find details on how to use
maths characters in ylab. Instead of m^2, I would like the 2 in superscript,
if possible. I would also like to place more padding on the label so that
the label is not obscured by the horizontal numbers.
y <- 1:10
x <- rnorm(10,50000,2000)
plot(x ~ y,
    ylab = 'Y Label (m^2)',
    las = 1,
    type =
2009 Mar 24
2
Legend containing maths symbol and values of variables
I need to have the maths symbol for >= in the legend, and to
substitute threshold variable with its value. Somehow, various
attempts weren't successful. Please help.
threshold <- 0.5
plot(NA, xlab="", ylab="", main="", axes=F, xlim=c(0,1), ylim=c(0,1),
xaxs="i", yaxs="i")
legend(x=0, y=1, fill=c("orange", "white",
2011 Apr 11
1
simple maths question
Hi Mrs & Ms "R",
    A simple maths question that I am trying to resolve with R: I need to
calculate the SE from a pvalue and it's beta... How to do this...?
Thank you very much and best regards!
Georg Ehret, Geneva, Switzerland.
	[[alternative HTML version deleted]]
2006 Dec 09
2
Floating point maths in R
Hi,
I am not sure if this is just me using R (R-2.3.1 and R-2.4.0) in the  
wrong way or if there is a more serious bug.  I was having problems  
getting some calculations to add up so I ran the following tests:
> (2.34567 - 2.00000) == 0.34567 <------- should be true
[1] FALSE
> (2.23-2.00) == 0.23 <------- should be true
[1] FALSE
> 4-2==2
[1] TRUE
> (4-2)==2
[1] TRUE
>
2000 Apr 17
3
Maths in R documentation (PR#523)
The document R-exts contains the following example of using 
mathematics in R documentation.
\deqn{p(x) = {\lambda^x\ \frac{e^{-\lambda}}{x!}}
     {p(x) = lambda^x exp(-lambda)/x!}
There is a syntax error in there, but that's not my point.
The problem is that using "R CMD Rd2dvi" I find that putting
the alternate forms of the equation on top of each other doesn't
work.
2012 Feb 21
0
nil can't be coerced into BigDecimal Options
hi guys im playing with RoR with the environment of rails 3 ruby 1.9 i
got stuck in
nil can''t be coerced into BigDecimal
error
i need to get the total cost of the products inside the cart i know
where the problem is(i think) but i almost did every thing
cart/show.html.rb
<div class="cart_title" >Your Cart</div>
    <table>
        <% for item in
2007 Aug 30
3
Rails - depot application
I''m doing the depot example in the Agle Web development book. I''m
getting this error:
"undefined method `product'' for #<BigDecimal:331ce70,''0.21E1'',8(8)>  "
"Extracted source (around line #9):
8: for item in @items
9: 	product = item.product
10: -%>
11:   <tr>
12:   <td><%= item.product%></td>"
2006 Jan 31
2
asigning values to atributies when source is nil
I want to use something similar to the following:
 @total_price += { product.price <> nil ? product.price : 0.0 }
This fails in rails with a "nil can''t be coerced into Float" error. 
 What is the (most) correct way to do this? 
On a related issue, what is the significance of the value 40 
following "cart.rb" in the trace snippet below?  The entire class 
file
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture- 
driven way of spec-ing or mocking. How the heck to you mock this so  
the code at line (2) and (4) work right? I''m still struggling with  
mocks but it seems like this can be done. Forgive the naivety of this  
question.
1.  def change_quantity
2.    @line_item = LineItem.find_by_id(params[:id])
3.    unless
2006 Jan 30
2
Cannot see what I have done wrong.
In the Agile Rails tutorial I am revisiting building a cart. I have 
followed the steps given in the book to create the class ''Cart''
thus:
class Cart
  attr_reader :items
  attr_reader :total_price
  def add_product(product)
    @items << LineItem.for_product(product)
    @total_price += product.price
  end
  def initialize
    @items = []
    @total_price = 0.0
  end
2006 Feb 27
2
Find not working
Hello all.
I have the following code (taken from the depot tutorial then modified)
def add_dish( dish, type, qnty )
    item = @items.find {|i| i.dish_id == dish.id && i.type == type }
    if item
      item.quantity += qnty.to_i
    else
      if type == ''Fresh''
        item = Fresh.for_dish(dish)
      else
        item = Frozen.for_dish(dish)
      end
     
2006 Aug 15
3
update or alter cart
I want to modify and update the items in  the Depot - "display_cart". 
Since the cart is in a session, its a little hard to get at the data.
I just want to create a way to change quantities, prices and 
recalculate.
Has someone done this, and could you point me to the right direction.
Thanks
Chas
-- 
Posted via http://www.ruby-forum.com/.
2006 Apr 14
3
Updateform with a has_many relationship ?
Hello all,
I would like to be able to update the "amount" of a certain item in  
me order list.
The problem I run into is how to define the text_field element.
@order is the current order, which has_many :order_item which in turn  
belongs_to :order.
order_item has a field "amount" which should be modified...
What I tried is this below,  but I get a undefined method  
2006 Jun 25
1
Unit Testing failure
When I run the unit testing code in Unit Testing Models chapter of the Agile Rails book, I get the
following error:
$ ruby test/unit/cart_test.rb 
Loaded suite test/unit/cart_test
Started
F.
Finished in 0.21806 seconds.
  1) Failure:
test_add_duplicate_product(CartTest) [test/unit/cart_test.rb:22]:
<4690> expected but was
<3579>.
2 tests, 3 assertions, 1 failures, 0 errors
require
2006 Feb 01
1
Problems with sample code from "agile webdev. w. rails"
Hello,
I am veeeery new to rails and also to ruby. I have 2 books here on my 
desk and try to go through it.
The first book is "Agile Webdevelopment with Rails" and I have trouble 
with the following code which I have from the book. I cant get it 
working. I searched a lot on google - and also on the erata pages of the 
book publisher but without any luck. I hope someone can help me.
2006 Feb 12
0
no method error - you have a nil object....
hi,
i''ve been cracking my head on this one for a while and would be humbly 
grateful for any pointers
i''m working through Agile Web Devopment w Rails and, in the depot 
example have created the cart class for session handling, but am getting 
the following error, which suggests the @items variable is not being 
populated with any data from LineItem
NoMethodError (You have a
2006 Feb 26
0
NoMethodError in Agile Web Devleopment Depot Tutorial
I''m working on building the shopping cart in the Depot tutorial in the 
Agile Web Development book. I''m at the part (about page 80) where you 
build the ability to add items to the cart. I''m able to get to 
/store/display_cart/ and it seems items are being added, but if I just 
click on a link to add an item (/store/add_to_cart/2) it gives me this:
NoMethodError in