Displaying 20 results from an estimated 1000 matches similar to: "Currency calculation"
2006 Mar 28
1
What if a webservice is not available = "execution expired" error
Hi,
I''m using a webservice in my application. How can I make it so that my
application will only try to connect to the webservice for a certain
period of time and then give up?
Right now my code is using a begin-rescue-else but sometimes I get a
"execution expired" error if the webservice is not available or takes
too long to respond.
Thanks,
Peter
begin
service =
2006 Jan 17
9
Formatting a float with a set number of decimals
Another newbie question:
How do i convert a float to a string, rounded to a certain number of
decimals?
Thanks
--
Posted via http://www.ruby-forum.com/.
2011 Oct 12
1
scopes related question
Hello,
Have a question related scope definition. I need to define a scope
based on related model attribute values like this.
class Product < ActiveRecord::Base
belongs_to :currency
scope :with_currency, lambda { |currency|
unless currency.to_s.upcase == ''ALL''
# here I need to define a scope that would test for currency.char_code
to match a passed value
# something
2013 Apr 03
4
Better way of writing R code
Dear R forum,
(Pl note this is not a finance problem)
I have two data.frames as
currency_df = data.frame(current_date = c("3/4/2013", "3/4/2013", "3/4/2013", "3/4/2013"), issue_date = c("27/11/2012", "9/12/2012", "14/01/2013", "28/02/2013"), maturity_date = c("27/04/2013", "3/5/2013",
2006 Feb 28
12
Examples for Money library ?
Can anybody share some examples of their Money implementation ?
I''m trying to setup a Model to use this library, but can''t seem to wrap my
head around how it is exactly supposed to work.
My Model (Foo) looks like:
===============
composed_of :commission, :class_name => "Money", :mapping => [
%w(commission_cents cents), %w(commission_currency currency) ]
Yet, in
2013 Apr 16
3
Splitting the Elements of character vector
Dear R forum
I have a data.frame
df = data.frame(currency_type = c("EURO_o_n", "EURO_o_n", "EURO_1w", "EURO_1w", "USD_o_n", "USD_o_n", "USD_1w", "USD_1w"), rates = c(0.47, 0.475, 0.461, 0.464, 1.21, 1.19, 1.41, 1.43))
currency_type rates
1 EURO_o_n 0.470
2 EURO_o_n 0.475
3 EURO_1w 0.461
2013 Apr 25
1
Linear Interpolation : Missing rates
Dear R forum
I have data.frame as
df = data.frame(rate_name = c("USD_1w", "USD_1w", "USD_1w", "USD_1w", "USD_1m", "USD_1m", "USD_1m", "USD_1m", "USD_2m", "USD_2m", "USD_2m", "USD_2m", "GBP_1w", "GBP_1w", "GBP_1w", "GBP_1w",
2008 Jun 29
2
How to write test about validates_associated
Here is my model:
class Account < ActiveRecord::Base
has_many :users, :dependent => :destroy
has_many :bus
belongs_to :currency
has_many :mylogs, :dependent => :destroy
has_many :batchuserdefines, :dependent => :destroy
has_many :materialuserdefines, :dependent => :destroy
has_many :materials
has_many :inventories
has_many :batchs
has_many :courses
has_many
2006 Mar 25
4
Rails PayPal and Currencies other than USD
Has anyone been able to make direct API calls to PayPal in currencies
other than USD? I get an error message "The currency code submitted is
not supported. Check the currency code and try again."
I''m using the PayPal plugin for Rails. I can successfully transact in
USD, but not AUD (Australian Dollars).
Cheers,
Dan
2006 May 08
2
Creating a "Foo has_many bars" association where bar isn''t a model.
Hi
Let''s say we have model Foo. Each Foo instance can have several bars.
Those bars are primitive, so they shouldn''t be models. For example,
Foo might be a type of convention, and the bars might be years the
convention was held in. Naively, we would have a conventions_years
date, and put:
has_many :years
inside class Convention. But then we''d get an error, since for
2011 Jan 07
1
Calculating Returns : (Extremely sorry for earlier incomplete mail)
Dear R forum helpers,
I am extremely sorry for the receipt of my incomplete mail yesterday. There was connectivity problem at my end and so I chose to send the mail through my cell, only to realize today about the way mail has been transmitted. I am again sending my complete mail through regular channel and sincerely apologize for the inconvenience caused.
## Here is my actual mail
Dear R
2006 Jan 17
2
money data types
What data type is best for storing currency? I''m trying to come up
with a reliable cross-database solution for rails that is not too
complicated. Since I''m going to have currency fields all over the
place, I''m not so sure that using two integer fields for each amount
would qualify as uncomplicated. I''d like to be able to use database
functions like SUM to
2006 Mar 03
1
number_to_currency() helper == non DRY == could be improved
Hi all,
Apologies in advance if I got this one wrong, I''m still just a
newbie ;-)
Going through the Apple ADC RoR tutorial it suddenly occurred to me
that the ''number_to_currency()'' helper method was not DRY streamlined.
Scenario::
The "number_to_currency()" methods options hash works great when I
need to dynamically display different currencies when I
2011 Jan 07
1
Currency return calculations
Dear sir, I am extremely sorry for messing up the logic
asking for help w.r.t. my earlier mails
I have tried to explain below what I am looking for.
I have a database (say, currency_rates) storing datewise
currency exchange rates with some base currency XYZ.
currency_rates <- data.frame(date =
c("12/31/2010", "12/30/2010", "12/29/2010",
2011 Sep 07
6
FactoryGirl doesnt produce unique names?!
Hey,
I got following very simple test case:
require ''spec_helper''
describe Country do
it "should create a new instance given valid attributes" do
Factory(:country)
end
end
Factory looks like:
Factory.sequence :country_name do |n|
"Country #{n}"
end
Factory.define :country do |c|
c.name Factory.next(:country_name)
c.nationality "Foo
2012 Nov 21
3
Problems understanding use of regular expression (in gsub) for manipulating currency
Hello,
After reading help file, various threads on this board, and other online tutorials, I've attempted to use gsub (using Perl-like syntax) to change a currency string into something that can be converted to numeric type using only one regular expression. Can anybody point out my error? Note that
> x <- "\"$ 1,200,300,400.50\""
Tried the following in an
2010 Feb 24
2
How to read percentage and currency data?
I'm struggling to find any help on this seemingly simple question - how does
one read data with percentage (%) or currency (?,$ etc.) signs? When I try
to read a data file which has any of those symbols in the data fields, they
are read as characters rather than values. Is there a function or library
which can deal with such values?
As an example, I use this sample from one of chinna's
2007 Feb 13
2
Computing stats on common parts of multiple dataframes
Folks,
I have three dataframes storing some information about
two currency pairs, as follows:
R> a
EUR-USD NOK-SEK
1.23 1.33
1.22 1.43
1.26 1.42
1.24 1.50
1.21 1.36
1.26 1.60
1.29 1.44
1.25 1.36
1.27 1.39
1.23 1.48
1.22 1.26
1.24 1.29
1.27 1.57
1.21 1.55
1.23 1.35
1.25 1.41
1.25 1.30
1.23 1.11
1.28 1.37
1.27 1.23
R> b
EUR-USD NOK-SEK
1.23 1.22
1.21 1.36
1.28 1.61
1.23 1.34
1.21 1.22
2006 Mar 08
1
question about options_for_select array
Hi!
If i have something like this used to create select tag:
options = [["Dollar", "$"], ["Kroner", "DKK"]]
and later read value from the database and get "DKK", what is the
easiest way to get "Kroner" value?
--
Posted via http://www.ruby-forum.com/.
2006 Jun 08
7
The Agile Book Messageboard?
Hello.
Where is there an Agile Messageboard?
On the first part of the Depot example, a price field shouldn''t be an
integer right? (it should be more of a float since a price has decimals)
Dominic Son
--
Posted via http://www.ruby-forum.com/.