search for: field1

Displaying 20 results from an estimated 72 matches for "field1".

Did you mean: field
2009 Jan 16
3
rspec model testing - test on user defined validation- How do I test that the create failed.
I''m new to rspec and looking for way to test a validation I added to a model. The test checks to see that if field1 has a value then field2 must be nil and vice versa. ------------------------------- When I did the rspec_scaffold it generated one test which worked before :each do @valid_attributes = { :field1 = "value for field1" :field2 = "value for field2" } MyTest.create!(...
2006 Aug 10
4
I need "validates_presence_of" help
Hi - I have 3 fileds a user can fill out. They can fill out 2 of them or just one of them, for example. fill out these 2 fields: Field1 and Field2 Or fill out this field: Field3 In my model how do I use validates_presence_of for Field1 and Field2 or just Field3. I want to do something like this: validates_presence_of Field1, Field2 OR validates_presence_of Field3 So the user can fill out Field1, Field2 and be a succesful upda...
2006 Apr 17
2
has_one problem in a form
...form helper? Basically, I have two models: class Resource < ActiveRecord::Base has_one :other_thing end class OtherThing < ActiveRecord::Base belongs_to :resource end It has the normal id-resource_id foreign key relationship. OtherThing has two fields, plus the foreign key, call them field1 and field2. In the ruby console, I can access field1 a couple of ways: resource.other_thing.field1 resource.other_thing[''field1''] Maybe a few other ways. What I want is to update field1 in a form that also updates fields in the resources table. It''s simple for fields...
2007 Feb 17
1
Conditional data frame manipulation
...ow of a data frame a certain field depending on another field in the same row. Dealing with data of some 30000 entries this works, but is horribly slow. Can anyone show this newbie how to do this properly (faster ;0)? for (i in 1:nrow(dataframe)){ if (any(grep('^yes$',dataframe[i,][['Field1']]))){ dataframe[i,]['Field1'] <- dataframe[i,]['Field2'] } else { dataframe[i,]['Field1'] <- NA } } Thanks for your insights, Joh
2008 May 29
2
how to use substring match as condition?
Hi, How can I use a substring match as a condition in a subset command? Sth like this: subset(input, field1=="blah1" & field2=="blah2") # but now with substring match in field2 subset(input, field1=="blah1" & field3 *substringmatch* "blah3") I've tried with gsub, but it won't work: subset(input, field1=="blah1" & gsub("blah3&qu...
2008 Jan 21
1
sorting in 'merge'
...number of common columns, but I cannot get a grasp on how it sorts the result. With sort=FALSE, I would expect it to give the result back sorted exactly as the input was but it seems it is not always the case, especially when there are repeats in the input. For example: > a = data.frame(field1=c(1,1,2,2),field2=c(1:2,1:2),var1=runif(4)) > b = data.frame(field1=c(2,2,1,1),field2=c(1,2,2,1),var2=runif(4)) > a field1 field2 var1 1 1 1 0.8327855 2 1 2 0.4309419 3 2 1 0.5134574 4 2 2 0.8063110 > b field1 field2 var2 1 2...
2006 Jan 13
4
How to add virtual fields in model
I want to add virtual fields in a model. table: field1 field2 I want to add field3 which is field1*2 + field2 I know tihs can be achieved in View, but I want it in model. Then I will pass this model to PagerRenderer to paginate. How to achieve this? thanks -- Posted via http://www.ruby-forum.com/.
2006 Jul 06
2
Not accepting nil values in fields when CREATING a record
Hello, I have a question for you. In my application, I want to make sure that the database doesn''t have any NULLs in fields. I can''t use validates_presence_of, because it will puke if there''s an empty string ("") So... is there an EASY way to check if a list of fields is null? Right now, I''m doing: def validate() [...]
2011 Oct 05
1
Weird behaviour of tab characters in a string in R (vs Python)
Hello, I wanted to parse some information from a text, where fields are tab separated. When I copy the text into an R session (under emacs) like: mystring <- "field1 field2 field3" the tab character is replaced by a single space! For ex, if I type mystring, I get: "field1 field2 field3" The tabs have disappeared!!! I checked with Python that the text I copied was tab separated indeed so I did the same, in a Python session: mystring = "...
2009 Aug 15
4
How to use R to perform prediction based on history data
Say I have a csv file, each row contains several fields, one of them are whether the row is success. In history data, I have all the fields including the result of whether it is success. In future data, I only have fields without the result. For example: history data: Field1 Field2 Field3 Field4 ResultField 1231 CA TRUE 443 TRUE 23231 NC TRUE 123 FALSE 1231 CA FALSE 243 TRUE The future data: Field1 Field2 Field3 Field4 23231 NC TRUE 123 I am newbie in R and statistics, I just feel R could...
2009 Sep 10
2
tranform a table?
hello everyone, i'm new to R, so i hope you dont mind a fairly basic R question. we're using R to manipulate the results of SQL queries and create an HTML output. I'm starting with a table that looks essentially like this: Name Field1 Field2 John value1 value2 Jane value3 value4 My table is stored as a dataframe. I'd like to efficiently produce an output that iterates through each row, transposes it and outputs an HTML table (one per row). like this: Name: John Field1: value1 Field2: value2 Name: J...
2006 Mar 21
1
Form Validation
Hi, I''ve got an interesting one here :) I have a form with three fields : serial_number initial surname now, if serial_number is entered, it must be between 1 and 64000. If it''s filled in, the other two fields must be blank. If serial_number is left blank then the other two boxes must be filled. Any suggestions? -- Posted via http://www.ruby-forum.com/.
2007 Feb 23
2
bug with boolean query evaluation containing parenthesis and NOT ?
...ed] query works well, however a variation which includes parenthesis seems to fail, in that it returns hits which should be excluded by the NOT term. This is surprising because in this simple case, the parenthesis shouldn''t change the Boolean evaluation ... any pointers? Working Query: field1:value1 AND NOT field2:value2 Failing Query: field1:value1 AND ( NOT field2:value2 ) Kind Regards Neville
2005 Dec 30
2
help on submit_to_remote
hi, read the API doc and made search with google but can''t get a precise explanation on how submit_to_remote work. can someone help on that? thanks
2007 Aug 06
1
rank in decreasing order
Hi All, I want to give ranks to elements in a column so I used: total_list$field1.rank <- rank(total_list$field1,ties.method="min") But this gives me the rank in increasing order. How do I get the ranks in decreasing order? I know decreasing = FALSE is not a legal argument here. Thanks. Jiong The email message (and any attachments) is for the sole use of the int...
2010 Oct 07
0
Categorical variables and Plotting a Cox model with interaction terms
...ohn Fox Appendix on Cox regression (http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-cox-regression.pdf) to run some analyses. I have been able to generate models and some simple figures e.g.: >library(splines) #required for survival package >library(survival) #req for Coxph >Field1<-read.csv("c:/R/Field1.csv") >attach(Field1) >mod.Field1 <- coxph(Surv(Survival, Censored) ~ Colour * Size + Site, data=Field1) >mod.Field1 Colour and Size are binary (dummy) variables (i.e., 0 and 1) and Site is a location (i.e., 1, 2, 3). Question 1: my site variable i...
2007 Jul 16
2
Field initialization order bug?
I believe that I may have found a bug in R. The top code sample gives an error as shown. However, by simply switching which field is initialized first as in the bottom code sample, it works as expected. This gives an error: a <- NULL a[["field1"]] <- 1 a[["field2"]] <- matrix(c(2,1), 1) Error in a[["field2"]] <- matrix(c(2, 1), 1) : more elements supplied than there are to replace Yet, this works as expected: a <- NULL a[["field2"]] <- matrix(c(2,1), 1) a[["field1"]] <-...
2007 Oct 26
2
Post problems
...ogy) where the mechanise packet has none. The firefox continuation packet: Content-Type: application/x-www-form-urlencoded\r\n Content-Length: 46 \r\n Wireshark then interprets what follows as ''Line-based text data: application/x-www-form-urlencoded", and this is the post data (field1=x&field2=y) The mechanize continuation packet does not contain this extra metadata, it merely contains the post data (field1=x&field2=y). Is this a problem? I''m not familiar enough with http to know. If it''s NOT a problem, any ideas where the post could be going wrong?...
2006 Jul 10
3
search plugin?
...arch associated fields. My database content is pretty small, so efficiently is not so critical. On the other hand I have ton of :belongs_to type fields, so I need something that works well with the Rails models. Any recommendations? == Example of what I need to work Assume I have a :belongs_to field1 in my model. I want to search all my records for hits in the field1.name associated field. Thanks Greg -- Greg Freemyer The Norcross Group Forensics for the 21st Century
2005 Dec 27
1
Rails/Ajax question from a newbie (to both)
...d it''s clearly not what I''m getting from the XML-RPC partial. What I have looks like this: <methodResponse> <params> <param> <value> <array> <data> <value> <struct> <member> <name>field1</name> <value> . . . It does have the <xml version... /> tag at the top, btw. It works fine with the code I have in the partial: <% @results.each do |item| %> <tr> <td class="cell"> <%= item.field1 %> <td> <...