Displaying 20 results from an estimated 2000 matches similar to: "Because I''m very slow - trying to use console"
2006 Feb 02
12
basic ''find'' question
I am struggling to understand the methodology here...
I have a find.rhtml
<%= start_form_tag :action => ''list2'', :first_name = client %>
<%# render :partial => ''form'' %>
<p><label for="client_first_name">First name</label><br/>
<%= text_field ''client'', ''first_name''
2006 Feb 03
4
contoller code mysteries
In my controller...this code works
def list2
first_name = params[:client][:first_name]
@myclients = Client.find(:all, :conditions =>
["first_name = :first_name", {:first_name => first_name}])
end
this code doesn''t...
def list2
first_name = params[:client][:first_name]
if first_name
searchstring = ''["first_name =
2005 Dec 31
7
Dynamic form? Not really!
Hi guru''s out there,
Im happilly coding my first rails app, and all goes well. I find myself
manually coding in a particular field all the time (company_id), that relates
the contact to a company. The total coding of this form seems somewhat much.
Could somebody tell me what Rails power I''m possibly missing and stuborn as I
am trying to do myself?
I was wondering if the
2006 Jan 20
3
postgres db setup
All of the tutorials and the Agile book use MySQL and I''ve got that
working. I am now trying to use PostgreSQL and can''t seem to get going.
Is my problem the db setup in postgresql?
I have installed postgres-pr
The error message when I try to access http://localhost:3000/clients
when using PostgreSQL (MySQL works fine)
ActiveRecord::StatementInvalid (RuntimeError:
ERROR
2006 Feb 21
8
Validations continued
I simply can''t figure this out. I have been reading and re-reading Agile
book and wiki.rubyonrails.org - all sorts of validation methods and
still, it doesn''t work.
Controller code
def create
@client = Client.new(params[:client])
if @client.save!
flash[:notice] = ''Client was successfully created.''
redirect_to :action =>
2006 Jan 26
42
ruby script/generate scaffold Product Admin hangs
Hi
I am running Mac OX tiger with the installed ruby 1.8.2, and
mysql5 (I checked that it was running in preference). I
tried to run the various fixes recommended in agileweb. I am
stuck on page 57, script/generate scaffold...
> Could you paste in your database.yml file, from the
> "config" folder inside your Rails app? If you have any
> passwords entered there, you should
2006 Mar 10
2
validation null objects and objects with data
I have a model where initially, they we don''t insert an gov_id value
because it isn''t known.
The field is given a value of "" because it is on the form.
I then added code to the ''create'' method to set that value to nil if it
is blank which seems to be fine but then it fails this validation (if
NULL)
validates_length_of :gov_id, :maximum =>
2006 Jun 25
4
Zebra Striping a Collection of Partials
I''m using render to display a collection of partials, where each partial
is a table row. Is it possible to zebra-stripe the table using this
method i.e. alternate table rows get a different CSS class? I can''t work
out how each row partial would know whether it was odd or even.
In the normal scheme of things I could do:
<% odd_or_even = 0
for asset in @assets
2006 Jan 25
17
Lookup pattern in Ruby
Hi folks,
I''m curious how a lookup with a large group of values would be handled
in Rails.
For example, I have a (contrived) AnimalType filtering a list of many
Animals--more than can be presented comfortably in a dropdown box.
Therefore I need to either redirect to another screen to select an
animal (returning after the selection is made), or show a dialog--modal
or otherwise--to
2006 Feb 25
7
Help with DRY: too much code in my view
I''m a newbie to rails, and really to the whole DRY and MVC thing as
well, except where I accidentally fell into things doing it my own way
in the past.
I''ve got a fairly complex DB structure I want to create an interface for
using Rails. Getting simple tables to display, edit, save, not too much
problem there. But where I''m having trouble is figuring out where to
2010 Feb 26
3
Preserving lists in a function
Dear R users,
A co-worker and I are writing a function to facilitate graph plotting in R. The function makes use of a lot of lists in its defaults.
However, we discovered that R does not necessarily preserve the defaults if we were to input them in the form of list() when initializing the function. For example, if you feed the function codes below into R:
myfunction=function(
list1=list
2012 Nov 20
1
tcl/tk problem with tklistbox,the " " character and Rcmdr.
I everyone,
i have a little problem with tklistbox,the " " character and Rcmdr.
Please look at this code
require(tcltk)
tt<-tktoplevel()
levels.list2 <-tklistbox(tt,selectmode="multiple",exportselection="FALSE",
height=4, yscrollcommand=function(...)tkset(levels.list2.scroll,...))
2011 Dec 05
9
jquery - word is not defined
Just starting out with a beginner book on jquery and the very first thing I am trying fails (has to be me)
Rails 3.1 - other jquery things working including a poor example of drag & drop that is my ultimate target here but just simply trying to get every alternating row in a table to have a different css class
So I''m using...
app/assets/javascripts/people.js.coffee and put in...
2009 Apr 15
6
Intersection of two sets of intervals
Hi,
Algorithm question: I have two sets of "intervals", where an interval is
an ordered pair [a,b] of two numbers. Is there an efficient way in R to
generate the intersection of two lists of same?
For concreteness: I'm representing a set of intervals with a data.frame:
> list1 = as.data.frame(list(open=c(1,5), close=c(2,10)))
> list1
open close
1 1 2
2 5
2011 Jan 08
3
Question on list objects
Hi, I have 2 questions on list object:
1. Suppose I have a matrix like:
dat <- matrix(1:9,3)
Now I want to replicate this entire matrix 3 times and put entire result in a list object. Means, if "res" is the resulting list then I should have:
res[[1]]=dat, res[[2]]=dat, res[[3]]=dat
How can I do that in the easilest manner?
2. Suppose I have 2 list objects:
list1 <- list2
2012 Jul 05
2
vector entry in matix
hi,
i'm trying to figure out if there's any possibility to write a whole vector
into a matrix or data.frame or something like that. i don't mean
transormation. Here an example:
[,1] [,2]
[1,] "a" "d"
[2,] "b" "e"
[3,] "c" "f"
where e.g. a is a<-c(0,1) vector of length 2, b a vector of length 4,... (i
know that
2011 May 05
1
lapply, if statement and concatenating to a list
Hi R users
I was wondering on how to use lapply & co when the applied function has a conditional statement and the output is a 'growing' object.
See example below:
list1 <- list('A','B','C')
list2 <- c()
myfun <- function(x,list2)
{
one_elem <- x
cat('one_elem= ', one_elem, '\n')
random <- sample(1:2,1)
show(random)
2010 Mar 15
1
rbind, data.frame, classes
Hi,
This has bugged me for a bit. First question is how to keep classes with
rbind, and second question is how to properly return vecotrs instead of
lists after turning an rbind of lists into a data.frame
list1=list(a=2, b=as.Date("20090102", format="%Y%m%d"))
list2=list(a=2, b=as.Date("20090102", format="%Y%m%d"))
rbind(list1, list2) #this loses the
2004 Oct 25
1
usage and behavior of 'setIs'
Hello,
am I using 'setIs' in the correct way in the subsequent (artifical) example?
Do I have to specify explicit 'setAs' for 'list' and 'vector' or
should this work automatically, since "getClass("List1")" states
an explicit coerce also for these classes.
I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000.
Thanks for your
2012 Apr 19
1
question about lists
I am new to R, and I have been running into the following situation
when I mistype a variable name in some code:
> list1 <- list( a=1, b=2 )
> list2 <- list( a=1 )
> list2$b <- list1$c
> list2
$a
[1] 1
I would think at the point where I am trying to reference a field
called "c" -- that does not exist -- in list1, there would be an error
flagged.
Instead, list1$c