similar to: text_field weirdness?

Displaying 20 results from an estimated 900 matches similar to: "text_field weirdness?"

2006 Jul 02
7
How can I intercept attribute calls?
Hi. I have two types of fields in my database, e.g. "name" and "name_ru". First one is a user''s name in english and the second one is in russian. I want to intercept calls like "c.name" and add "_ru" to it if current language is russian (I have my own Locale class like n Globalize). So I want such thing: -- Locale.set("en-US") c.name
2006 Jan 31
1
Inserting NULL values into PostgreSQL from Rails
I have several TIME columns in a PostgreSQL table that I am trying to store times of day in. These columns allow NULL values since there may some records where there is no time to store. My problem is that Rails is inserting a default value into these fields (the result of calling Time.new) regardless of the value that is passed from a form. I am generating select tags with possible time
2006 Jul 13
4
Does text_field go directly to attributes hash in AR object?
All, I''m having a hell of a time figuring out what is going on here. I''m trying to override one of my getters so that I can format it a certain way in my form. But I can''t seem to get text_field to call the appropriate method on my object. So here''s my getter: public def FAX fax = read_attribute(:FAX) puts fax
2006 Jul 03
4
text_field doesn''t call overridden ActiveRecord getters
All, In a template, I have <%= text_field :target_list, :DateReceived, { :title => ''uploaded_at'', :class => ''target_list_info'', :disabled => ''true'' } %> Here is the DateReceived method on my
2006 Jun 28
3
how do I validate currency format if I am storing in cents?
Hi all - To avoid floating point issues, I''ve decided to store monetary values in cents in the database. However, the user will enter these in dollars and cents. Two questions: 1) How do I do the validation for the currency format? It looks like ActiveRecord truncates the cents since it thinks the field type is a Fixnum. Am I forced to do validation in the controller? 2) Where
2006 Feb 24
2
Formatting values of numbers using text_field
Anyone have a quick solution on how to format a number in a text_field tag? <% text_field "price", "amount" %> returns 100.0 and it would be nice if it showed 100.00 Of course, number_with_precision works nicely, but how do you make that work with text_field? I thought maybe overriding the getter in the model. However, this means I would have to bring the helper
2009 Feb 09
3
RSpec Testing ActiveRecord config dependency.
I have the following library code: def normal_time_now return DateTime.now.utc if default_timezone == :utc return DateTime.now end This is dependent upon a setting in config/environment.rb # Make Active Record use UTC-base instead of local time config.active_record.default_timezone = :utc I want to test that I get the expected results with the config set to utc and
2005 Oct 28
4
find_by_sql column types
Hello-- There must be a better way to do this. I have a class method in my model that finds averages and does a few calculations using find_by_sql. The problem I¹m encountering is that all computed columns from MySQL come back as type string. E.g., def self.find_averages(domain_id) if @@domain_average return @@domain_average else @@domain_average =
2010 Mar 06
1
TukeyHSD model thing
Hi, I am trying to reproduce a tukey test in R ========================== x=c(145,40,40,120,180, 140,155,90,160,95, 195,150,205,110,160, 45,40,195,65,145, 195,230,115,235,225, 120,55,50,80,45 ) y2=c( rep(as.character(1),5), rep(as.character(2),5), rep(as.character(3),5), rep(as.character(4),5), rep(as.character(5),5), rep(as.character(6),5) ) crd2=data.frame(x,y2)
2010 Mar 05
2
Selecting rows of a matrix based on some condition on the columns
The data set consists of two sets of matrices, as labelled by the columns, T's and C's. > xy x T1 T2 T3 T4 T5 C1 C2 C3 C4 C5 [1,] 50 0.00 0.00 33.75 0.00 0.00 0.00 36.76 0.00 35.26 0.00 [2,] 13 34.41 0.00 0.00 36.64 32.86 34.11 35.80 37.74 0.00 0.00 [3,] 14 35.85 0.00 33.88 36.68 34.88 34.58 0.00 32.75 37.45 0.00 [4,] 33 34.56
2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on this, I think it''s time to ask the list. Postgres stores a Date in YYYY-MM-DD format. My users want the dates in MM/DD/YYYY format. Sure, I could explicitly convert it on the app level every place where a date is displayed, but that seemed like a DRY violation. I thought I''d be clever and simply
2012 Jan 11
2
Finding percentile of a value from an empirical distribution
Hello, I am not sure how to do this in R. Any suggestion would be appreciated. I have a vector of values from where I build an empirical CDF. For example: > x <- seq(1,100) > x <- sample(x,1000,replace=T) > quantile(x,probs=seq(0,1,.05)) 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50% 55% 1.00 5.00 10.00 16.00 20.00 25.00 31.00 36.00 41.00
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
2023 Jun 29
3
Plotting factors in graph panel
Thanks, Pikal and Jim. Yes, it has been a long time Jim. I hope you have been well. Pikal, thanks. Your solution may be close to what I want. I did not know that I was posting in HTML. I just copied the data from Excel and posted in the email in Gmail. The data is still in Excel, because I have not yet figured out what is a good way to organize it in R. I am posting it again below as text. These
2023 Jun 28
2
Plotting factors in graph panel
Hello, I want to plot the following kind of data (percentage of respondents from a survey) that varies by Income into many small *line* graphs in a panel of graphs. I want to omit "No Answer" categories. I want to see how each one of the categories (percentages), "None", " Equity", etc. varies by Income. How can I do this? How to organize the data well and how to
2006 Feb 14
6
Creating a String of Random Characters and Numbers
I want to create a random string of length n that is made up of characters and integers. Is there a function in rails or ruby that allows me to do this? Thank you my friend :-). John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net
2009 Oct 24
1
dev.copy(postscript,...) generates a disrupted string
Dear R-Users, I have the following problem: I would like to create a postscript file containing an r-plot with the string "\\vartheta" in it (reason: this is later converted to the TeX-string "\vartheta" and a vartheta is printed in the figure). In the minimal example below, the problem is that the created postscript file does _not_ contain the string "\\vartheta
2005 Jan 06
1
nls - convergence problem
Dear list, I do have a problem with nls. I use the following data: >test time conc dose 0.50 5.40 1 0.75 11.10 1 1.00 8.40 1 1.25 13.80 1 1.50 15.50 1 1.75 18.00 1 2.00 17.00 1 2.50 13.90 1 3.00 11.20 1 3.50 9.90 1 4.00 4.70 1 5.00 5.00 1 6.00 1.90 1 7.00 1.90 1 9.00 1.10 1 12.00 0.95 1 14.00
2023 Jun 28
1
Plotting factors in graph panel
Hi Anupam, Haven't heard from you in a long time. Perhaps you want something like this: at_df<-read.table(text= "Income MF MF_None MF_Equity MF_Debt MF_Hybrid Bank_None Bank_Current Bank_Savings Bank_NA $10 1 3.05 29.76 31.18 36.0 46.54 24.75 25.4 3.307 $25 2 2.29 28.79 32.64 36.27 54.01 24.4 18.7 2.891 $40 3 2.24 29.51 34.31 33.94 59.1 25.0 29 13.4 $75 4 1.71 28.90 35.65 33.74
2007 Feb 02
0
Fwd: [ mocha-Bugs-7834 ] infinte_range.rb makes incorrect assumption about to_f
Thanks for reporting the bug below. You''re absolutely right. Renamed Range#to_s implementation to #mocha_inspect and checked first and last respond_to?(:to_f) as you suggested. Sorry for the delay - I wasn''t monitoring the rubyforge trackers. I am now! Should be fixed in revision 99 of trunk. -- James. http://blog.floehopper.org ---------- Forwarded message ---------- From: