Search Results

Search found 469 results on 19 pages for 'currency'.

Page 2/19 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • I want to use a Currency control in Ajax that accepts any number of inputs

    - by Viswa
    I want to use a Currency Control in Ajax that accepts any number of input digits( with decimal maximum up to two digits only) For example If i am having a code like this: TextBox txt = new TextBox(); txt.Text ="99.99"; txt.Id = "TextBox1"; MaskedEditExtender mskEdit = new MaskEditExtender(); mskEdit.Id="CurrencyController"; mskEdit.Mask = "9,999,999.99"; mskEdit.TargetControlId = txt.Id; mskEdit.DisplayMoney = MaskedEditShowSymbol.Left; mskEdit.InputDirection = MaskedEditInputDirection.RightToLeft; mskEdit.MaskType = "None"; The issue is tha, when i run the above code the TextBox(textbox input text given is 99.99 but it is showing as $,,_.99. Please help me on this issue.

    Read the article

  • Zend framework currency validation

    - by Dan
    How can I validate (a form element in this case) to ensure that the value is a currency? Have looked at Zend_Validate_Float. Needs to check that value is between 0 and 2dp. Ideally locale-aware (as ZVF is) to allow for locale specific formatting (thousands, decimal as comma/dot) Would also want to extend to allow/disallow negative values And provide optional upper/lower limits. Is the key, as I can do 3. and 4. with a chain. Do I need regex?

    Read the article

  • Ruby on Rails - Currency : commas causing an issue.

    - by easement
    Looking on SO, I see that the preferred way to currency using RoR is using decimal(8,2) and to output them using number_to_currency(); I can get my numbers out of the DB, but I'm having issues on getting them in. Inside my update action I have the following line: if @non_labor_expense.update_attributes(params[:non_labor_expense]) puts YAML::dump(params) The dump of params shows the correct value. xx,yyy.zz , but what gets stored in the DB is only xx.00 What do I need to do in order to take into account that there may be commas and a user may not enter .zz (the cents). Some regex and for comma? how would you handle the decimal if it were .2 versus .20 . There has to be a builtin or at least a better way. My Migration (I don't know if this helps): class ChangeExpenseToDec < ActiveRecord::Migration def self.up change_column :non_labor_expenses, :amount, :decimal, :precision => 8, :scale => 2 end def self.down change_column :non_labor_expenses, :amount, :integer end end

    Read the article

  • Rails - Format number as currency format in the Getter

    - by daemonsy
    I am making a simple retail commerce solution, where there are prices in a few different models. These prices contribute to a total price. Imagine paying $0.30 more for selecting a topping for your yogurt. When I set the price field to t.decimal :price, precision:8, scale:2 The database stores 6.50 as 6.5. I know in the standard rails way, you call number_to_currency(price) to get the formatted value in the Views. I need to programmatically call the price field as well formatted string, i.e. $6.50 a few places that are not directly part of the View. Also, my needs are simple (no currency conversion etc), I prefer to have the price formatted universally in the model without repeated calling number_to_currency in views. Is there a good way I can modify my getter for price such that it always returns two decimal place with a dollar sign, i.e. $6.50 when it's called? Thanks in advance.

    Read the article

  • Format decimal to currency, should be in cents for values $0 to $1

    - by Spongeboy
    I have a decimal variable which represents a donation amount. Currently I am displaying it on screen as a currency like so- DonationAmount.ToString("C"); This gives the following output (given a US locale) 1 -> $1.00 2 -> $2.00 0.5 -> $0.50 I am happy with the first two example, but want to have "0.5" show as "50c". My current solution is with a conditional- if (DonationAmount > 1) return (DonationAmount * 100m).ToString() + "c"; else return DonationAmount.ToString("C"); Is there a better way?

    Read the article

  • asp.net MVC 1.0 and 2.0 currency model binding

    - by David Liddle
    I would like to create model binding functionality so a user can enter ',' '.' etc for currency values which bind to a double value of my ViewModel. I was able to do this in MVC 1.0 by creating a custom model binder, however since upgrading to MVC 2.0 this functionality no longer works. Does anyone have any ideas or better solutions for performing this functionality? A better solution would be to use some data annotation or custom attribute. public class MyViewModel { public double MyCurrencyValue { get; set; } } A preferred solution would be something like this... public class MyViewModel { [CurrencyAttribute] public double MyCurrencyValue { get; set; } } Below is my solution for model binding in MVC 1.0. public class MyCustomModelBinder : DefaultModelBinder { public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { object result = null; ValueProviderResult valueResult; bindingContext.ValueProvider.TryGetValue(bindingContext.ModelName, out valueResult); bindingContext.ModelState.SetModelValue(bindingContext.ModelName, valueResult); if (bindingContext.ModelType == typeof(double)) { string modelName = bindingContext.ModelName; string attemptedValue = bindingContext.ValueProvider[modelName].AttemptedValue; string wantedSeperator = NumberFormatInfo.CurrentInfo.NumberDecimalSeparator; string alternateSeperator = (wantedSeperator == "," ? "." : ","); try { result = double.Parse(attemptedValue, NumberStyles.Any); } catch (FormatException e) { bindingContext.ModelState.AddModelError(modelName, e); } } else { result = base.BindModel(controllerContext, bindingContext); } return result; } }

    Read the article

  • Facelet does not convert formatted currency correctly

    - by c0d3x
    Hi, I have the follwing code inside a facelet page: <h:inputNumber value="bean.property"> <f:convertNumber type="currency" /> </h:inputNumber The converter is because there can be a kind of default value inside the input field, which comes from the bean property. Everything is rendered correctly. The value inside the input field is rendered with an "€" character (e.g. "1.453 €". When I submit the form there comes an error up: "nameOfInputField" konnte nicht als ein Geldbetrag erkannt werden '304,00 â¬' In english it is some like: "nameOfInputField" could not be regognized as an amount of money '304,00 â¬' Please have a look at the "€" character. It seems to be printed as "â¬". While it was rendered correctly before submitting the form, now it looks like "â¬" inside the error message and inside the input field. All pages are encoded in UTF-8. What is the reason for this error? How can fix it? Thanks in advance

    Read the article

  • Programmatically access currency exchange rates

    - by Adam Pierce
    I'm setting up an online ordering system but I'm in Australia and for international customers I'd like to show prices in US dollars or Euros so they don't have to make the mental effort to convert from Australian dollars. Does anyone know if I can pull up to date exchange rates off the net somewhere in an easy-to-parse format I can access from my PHP script ? UPDATE: I have now written a PHP class which implements this. You can get the code from my website.

    Read the article

  • rails different currency formats

    - by SMiX
    Hello everybody. I need to show user amount presented in different currencies. e.q. : Your balance: $ 100 000.00 € 70 000.00 3 000 000,00 ???. So I need to use number_to_currency three times with different locales(en, eu, ru). What is the right way to do it?

    Read the article

  • Google Currency Convertor JSON API

    - by Gopinath
    There are many live currency conversion services available on the web and the popular one’s among them are – Google, Yahoo, MSN & XE. Among all these four Google is the developer’s darling and it provides a simple JSON API that can be integrated in your applications.  http://www.google.com/ig/calculator?hl=en&q=1USD=?INR Using the API is very simple and it takes two parameters as input. The first parameter “hl” is the language code in which you want output. The second parameter “q” is the conversion query in the format <number><from currency code>=?<to currency code>. In the URL give above the query requests for conversion of 1 USD in INR. JSON output for the above query would be  similar to {lhs: "1 U.S. dollar",rhs: "54.4602984 Indian rupees",error: "",icc: true} Examples: 100 USD in INR  http://www.google.com/ig/calculator?hl=en&q=100USD=?INR Example 2: 1 GBP in INR http://www.google.com/ig/calculator?hl=en&q=1GBP=?INR Example 3: 1 USD in INR, output the data in French language http://www.google.com/ig/calculator?hl=fr&q=1USD=?INR   This is an undocumented service and expect changes at any time. But as long as it works, you got a programmatic way to convert currencies.

    Read the article

  • Web-app currency input/manipulation/calculation with javascript .. there has got to be a better (fra

    - by dreftymac
    BACKGROUND: I am of the "user-input-lockdown" school of thought. Whenever possible, I try to mistrust and sanitize user input, both client side and server side; and I try to take multiple opportunities to restrict possible inputs to a known subset of possibilities, usually this means providing a lot of checkboxes and select lists. (This is from the usability side of things, I know security-wise that malicious users can easily bypass fixed user input GUI controls). PROBLEM: Anyway, the problem always arises with non-fixed input of currency. Whenever I have to accept a freely-specified dollar amount as user input, I always have to confront these problems/annoyances and it is always painful: 1) Make sure to give the user two input boxes for each currency_datapoint, one for the whole_dollar_part and another for the fractional_pennies_part 2) Whenever the user changes a currency_datapoint, provide keystroke-by-keystroke GUI feedback to let them know whether the currency_datapoint is well-formed, with context-appropriate validation rules (e.g., no negatives?, nonzero only?, numeric only!, no non-numeric punctuation! no symbols!) 3) For display purposes, every user-provided currency_datapoint should be translated to human-readable currency formatting (dollar sign, period, commas provided by the app, where appropriate) 4) For calculation purposes, every user-provided currency_datapoint has to be converted to integer (all pennies, to avoid floating point errors) and summed into a grand total with zero or more subtotals. 5) Every user-provided currency_datapoint should be displayed or displayable in a nice "tabular" format, which auto-updates as the user enters each currency_datapoint, including a baloon that warns when one or more currency_datapoints is not well-formed. I seem to be re-inventing this wheel every time I have to work with currency in Javascript on the client side (server side is a bit more flexible since most programming languages have higher-level currency formatting logic). QUESTION: Has anyone out there solved the problem of dealing with the above issues, client side, in a way that is server-side-technology-stack agnostic, (preferrably plain javascript or jquery)? This is getting old, there has to be a better way.

    Read the article

  • GDD-BR 2010 [0D] Panel: Social Gaming, Virtual Currency and Ad Campaigns

    GDD-BR 2010 [0D] Panel: Social Gaming, Virtual Currency and Ad Campaigns Speakers: Eduardo Thuler, Juan Franco, Daniel Kafie, Bruno Souza Track: Panels Time slot: D [13:50 - 14:35] Room: 0 Social games are more than just fun: in recent years they have more than proved their value as a profitable business area. In this panel, you will have the opportunity to listen to what successful social gaming companies in Latin America have to say on social applications and their approaches to monetization such as virtual currency and in-game ad campaigns. Learn from their experience as they share their challenges and success stories in this exciting market. From: GoogleDevelopers Views: 1 0 ratings Time: 43:04 More in Science & Technology

    Read the article

  • How do you prevent inflation in a virtual economy?

    - by Tetrad
    With your typical MMORPG, players can usually farm the world for raw materials essentially forever. Monsters/mineral veins/etc are usually on some respawn timer so, other than time, there really isn't a good way to limit the amount of new currency entering the system. So that really only leaves money sinks to try to take money out of the system. What are some strategies to prevent inflation of the in-game currency?

    Read the article

  • How best to calculate derived currency rate conversions using C#/LINQ?

    - by chillitom
    class FxRate { string Base { get; set; } string Target { get; set; } double Rate { get; set; } } private IList<FxRate> rates = new List<FxRate> { new FxRate {Base = "EUR", Target = "USD", Rate = 1.3668}, new FxRate {Base = "GBP", Target = "USD", Rate = 1.5039}, new FxRate {Base = "USD", Target = "CHF", Rate = 1.0694}, new FxRate {Base = "CHF", Target = "SEK", Rate = 8.12} // ... }; Given a large yet incomplete list of exchange rates where all currencies appear at least once (either as a target or base currency): What algorithm would I use to be able to derive rates for exchanges that aren't directly listed? I'm looking for a general purpose algorithm of the form: public double Rate(string baseCode, string targetCode, double currency) { return ... } In the example above a derived rate would be GBP-CHF or EUR-SEK (which would require using the conversions for EUR-USD, USD-CHF, CHF-SEK) Whilst I know how to do the conversions by hand I'm looking for a tidy way (perhaps using LINQ) to perform these derived conversions perhaps involving multiple currency hops, what's the nicest way to go about this?

    Read the article

  • How can find out the system default currency symbol on BlackBerry?

    - by ageektrapped
    I have a need to display a currency value in my application. There doesn't seem to be an easy way to do this with the RIM API, so I'm reduced to creating my own solution (a common refrain for BlackBerry development, unfortunately) Currently I'm using the Formatter class, from javax.microedition.locale like so protected String formatResult(double result) { try { Locale l = Locale.getDefaultForSystem(); Formatter formatter = new Formatter(l.toString()); return formatter.formatCurrency(result); } catch (UnsupportedLocaleException e) { return "This fails for the default locale because BlackBerry sucks"; } } I always hit the catch block in the simulator. Since this doesn't work by default on the simulator, I'm hesitant to put it in the application. So I have two questions: Can anyone tell me if the above solution is the way to go? And how to fix it, of course. Is there a way I can retrieve the currency symbol for the current locale programmatically so I can format myself?

    Read the article

  • What is the best currency API out there?

    - by YouBook
    I may be asking an odd question, but webmasters seem like a decent place to post this. I'm in the search for an accurate, easy API (such as using JSON or XML) so I can use my web application. I've been trying Google's secret API, but it's dependency isn't that good because of parsing the string (weird JSON format that PHP sometimes return incorrect data or truncates the string due to parsing error, but Google's API is fair but can be improved. So, all I'm asking is your current best currency API out there, I want to have them to include documented API so I can use it with PHP. Cheers.

    Read the article

  • How to round currency values [migrated]

    - by Kenny
    I already have several ways to solve this, but I am interested in whether there is a better solution to this problem. Please only respond with a pure numeric algorithm. String manipulation is not acceptable. I am looking for an elegant and efficient solution. Given a currency value (ie $251.03), split the value into two half and round to two decimal places. The key is that the first half should round up and the second should round down. So the outcome in this scenario should be $125.52 and $125.51.

    Read the article

  • Using MySQL to generate daily sales reports with filled gaps, grouped by currency

    - by Shane O'Grady
    I'm trying to create what I think is a relatively basic report for an online store, using MySQL 5.1.45 The store can receive payment in multiple currencies. I have created some sample tables with data and am trying to generate a straightforward tabular result set grouped by date and currency so that I can graph these figures. I want to see each currency that is available per date, with a 0 in the result if there were no sales in that currency for that day. If I can get that to work I want to do the same but also grouped by product id. In the sample data I have provided there are only 3 currencies and 2 product ids, but in practice there can be any number of each. I can correctly group by date, but then when I add a grouping by currency my query does not return what I want. I based my work off this article. My reporting query, grouped only by date: SELECT calendar.datefield AS date, IFNULL(SUM(orders.order_value),0) AS total_value FROM orders RIGHT JOIN calendar ON (DATE(orders.order_date) = calendar.datefield) WHERE (calendar.datefield BETWEEN (SELECT MIN(DATE(order_date)) FROM orders) AND (SELECT MAX(DATE(order_date)) FROM orders)) GROUP BY date Now grouped by date and currency: SELECT calendar.datefield AS date, orders.currency_id, IFNULL(SUM(orders.order_value),0) AS total_value FROM orders RIGHT JOIN calendar ON (DATE(orders.order_date) = calendar.datefield) WHERE (calendar.datefield BETWEEN (SELECT MIN(DATE(order_date)) FROM orders) AND (SELECT MAX(DATE(order_date)) FROM orders)) GROUP BY date, orders.currency_id The results I am getting (grouped by date and currency): +------------+-------------+-------------+ | date | currency_id | total_value | +------------+-------------+-------------+ | 2009-08-15 | 3 | 81.94 | | 2009-08-15 | 45 | 25.00 | | 2009-08-15 | 49 | 122.60 | | 2009-08-16 | NULL | 0.00 | | 2009-08-17 | 45 | 25.00 | | 2009-08-17 | 49 | 122.60 | | 2009-08-18 | 3 | 81.94 | | 2009-08-18 | 49 | 245.20 | +------------+-------------+-------------+ The results I want: +------------+-------------+-------------+ | date | currency_id | total_value | +------------+-------------+-------------+ | 2009-08-15 | 3 | 81.94 | | 2009-08-15 | 45 | 25.00 | | 2009-08-15 | 49 | 122.60 | | 2009-08-16 | 3 | 0.00 | | 2009-08-16 | 45 | 0.00 | | 2009-08-16 | 49 | 0.00 | | 2009-08-17 | 3 | 0.00 | | 2009-08-17 | 45 | 25.00 | | 2009-08-17 | 49 | 122.60 | | 2009-08-18 | 3 | 81.94 | | 2009-08-18 | 45 | 0.00 | | 2009-08-18 | 49 | 245.20 | +------------+-------------+-------------+ The schema and data I am using in my tests: CREATE TABLE orders ( id INT PRIMARY KEY AUTO_INCREMENT, order_date DATETIME, order_id INT, product_id INT, currency_id INT, order_value DECIMAL(9,2), customer_id INT ); INSERT INTO orders (order_date, order_id, product_id, currency_id, order_value, customer_id) VALUES ('2009-08-15 10:20:20', '123', '1', '45', '12.50', '322'), ('2009-08-15 12:30:20', '124', '1', '49', '122.60', '400'), ('2009-08-15 13:41:20', '125', '1', '3', '40.97', '324'), ('2009-08-15 10:20:20', '126', '2', '45', '12.50', '345'), ('2009-08-15 13:41:20', '131', '2', '3', '40.97', '756'), ('2009-08-17 10:20:20', '3234', '1', '45', '12.50', '1322'), ('2009-08-17 10:20:20', '4642', '2', '45', '12.50', '1345'), ('2009-08-17 12:30:20', '23', '2', '49', '122.60', '3142'), ('2009-08-18 12:30:20', '2131', '1', '49', '122.60', '4700'), ('2009-08-18 13:41:20', '4568', '1', '3', '40.97', '3274'), ('2009-08-18 12:30:20', '956', '2', '49', '122.60', '3542'), ('2009-08-18 13:41:20', '443', '2', '3', '40.97', '7556'); CREATE TABLE currency ( id INT PRIMARY KEY, name VARCHAR(255) ); INSERT INTO currency (id, name) VALUES (3, 'Euro'), (45, 'US Dollar'), (49, 'CA Dollar'); CREATE TABLE calendar (datefield DATE); DELIMITER | CREATE PROCEDURE fill_calendar(start_date DATE, end_date DATE) BEGIN DECLARE crt_date DATE; SET crt_date=start_date; WHILE crt_date < end_date DO INSERT INTO calendar VALUES(crt_date); SET crt_date = ADDDATE(crt_date, INTERVAL 1 DAY); END WHILE; END | DELIMITER ; CALL fill_calendar('2008-01-01', '2011-12-31');

    Read the article

  • Week in Geek: New Malware Steals Bitcoin Currency

    - by Asian Angel
    This week we learned how to easily change a dual-booting PC’s default OS, “extract audio from any video using VLC, sneak around paywalls, & delay Windows Live Mesh during boot”, shrink videos to fit an Android phone with VLC, fix damaged or broken audio cables, “decide between an ISO or TS folder, help Windows 7 remember folder locations, & convert books for the Kindle”, and more. Photo by Profound Whatever.How to Make and Install an Electric Outlet in a Cabinet or DeskHow To Recover After Your Email Password Is CompromisedHow to Clean Your Filthy Keyboard in the Dishwasher (Without Ruining it)

    Read the article

  • Problem with currency formats and big numbers [on hold]

    - by user132750
    I am working on a dollars to euros/euros to dollars converter in C#. I got the formula, $ times 0.73361 = euro, and I have checked Google with the answers. They were right, (1 dollar equals 0.73 euros). However, it stops working properly when the dollar input value is higher than $1363. This is what I get with $1364: $1364 = 1 000,64 €. I don't know what to do, will someone please help me? Thanks. decimal toEuro; Val.doy = "$" + decimal.Parse(richTextBox1.Text); //Ignore this, it's for the output form CultureInfo eu = new CultureInfo("fr-FR"); toEuro = decimal.Parse(richTextBox1.Text.Trim()); toEuro = toEuro * 0.73361m; richTextBox1.Clear(); Val.duh = toEuro.ToString("C2", eu);

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >