Displaying 20 results from an estimated 1000 matches similar to: "Keeping the queries down..."
2011 Oct 19
2
Error in 1/ue : non-numeric argument to binary operator.
hi, I have a problem. The R shows that
Error in 1/ue : non-numeric argument to binary operator.
Here is the code:
# simulation of tempered stable processes by compound Poisson approximation
tsp<-function(n,e,a,c,lema){
x<-numeric(n)
for (i in 1:n){
repeat{
w<-runif(1)
v<-runif(1)
x<-e*(w^(-1/a))
fex<-function(x1){ if (x1>=e) {a1<-a*(e^(-a))/(x^a-1)}}
2004 Jul 08
1
(PR#7070)
> version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
minor 7.1
year 2003
month 06
day 16
language R
Bug:
integrate(f,lower,upper,extra_args)
where
f <- function(x,extra_args)
{
body
}
integrate doesn't pass the extra arguments when calling f.
As a first check of this finding I integrated dnorm from
2009 May 31
9
No more than one "instances" of a type in define()?
Hi folks,
when I try to do something like:
define railsproject($name, $uid, $gid, $userpass, $sqlpass) {
mysql_database { "$name_staging": ensure => present }
mysql_database { "$name_production": ensure => present}
....more stuff...
}
I get:
Puppet::Parser::AST::Resource failed with error ArgumentError:
Duplicate definition: Mysql_database[] is already
2006 May 08
2
Queries with has_and_belongs_to_many relationship
I was able to create a has_and_belongs_to_many relationship for my app,
but now I''m not too sure how to write queries for it.
Basically, I have a table ''courses'' that has_and_belongs_to_many
''categories'' and vice versa
So I''m trying to figure out how I would find only the courses that
belong to a category that I specify.
Let''s
2011 Sep 05
3
Fiel uploading framework
I need to setup something for a group of CAD guys to provide a web interface for
clients/customers to send files to them. I was hoping to have an interface where the
customer would be given a logon and it would email a link to the employee upon his
successful upload. This would require an internal facing site to provision a slot to give
to a customer.
Anyone know of a project like this so I
2010 Sep 12
11
Rails 3: finding a record by name in multilingual app
Hello,
I upgraded my application from Rails 2 to Rails 3 and ran into a
problem. In rails 2 I could use the english name of the record to find
it like:
Page.find_by_name("Welcome")
even though the user chose German as the language (which of course
showed the German welcome page.
Eversince I switched to Rails 3 (default_locale still :en) I can''t find
anything by giving the
2006 Jul 02
5
Pretty URLs -> Routes
Hi
I am having issues with getting my pretty urls to work.
routes.rb:
map.connect '':user'' , :controller => ''front'' ,
:action => ''list'' ,
:filter => ''user''
front_controller.rb:
def list
@advert_pages, @adverts = paginate :adverts, :per_page => 10
@user =
2008 Jul 08
3
undefined method `name' ...........
Hi Community....
I''m new in this game, so this might be a easy question, but I have
done my google, without result, so I will try this....
I''m learning ROR, and I''m using Patrick Lens ''Ruby on Rails'' book.
(This is written for ror 1.x - and I''m using NetBeans 6.1 - ror 2.x -
this might be the problem...)
But...
I have made this
2006 Jul 17
10
getting the user name
Hi I am new to ruby and trying to obtain the user name in the login
index.rhtml where I could display "You have logged in [user name]"
How could I do this? I have been trying different options after reading
the ruby manual but still throw an error.
please help
--
Posted via http://www.ruby-forum.com/.
2007 Jun 18
2
extending Array class with a method
Hi,
Let''s say I have an ActiveRecord::Base class and I want to be able to
call a method on an Array of these items. For instance, perhaps
there''s a class called Country and another called business, and I''d
like to be able to do something like
great_white_north = Country.find_by_name(''Canada'')
canuck_enterprises = great_white_north.businesses
2006 May 29
4
Prompting user to enter value to feed Find
Hi,
While viewing part of a long list of records, the user may want to do a
Find of a specific record (for example, find_by_name). The found record
is then displayed using the list view. I''ve searched the wiki and
couldn''t find a sample or information that will help directly in
implementing this function. Any pointers?
Thanks!
gk
--
Posted via http://www.ruby-forum.com/.
2006 Apr 22
3
how do I manually throw a 404?
I''m sure this has been asked before but a quick search on the web didn''t
give me any hints..
I''d like to do this:
@person = Person.find_by_name
throw_page_not_found unless @person
Anybody know how to do this, do I have to manually tinker with the
response object?
--
Posted via http://www.ruby-forum.com/.
2006 Mar 02
3
Modifying "Find" to always add a condition?
I''d like to always add a condition to any version of "find" (e.g.
Thing.find(), Thing.find_by_name(), Thing.find_by_whatever) so that in
addition to whatever conditions are set, an additional condition is set
:conditions=>"user_id=#{current_user.id}"
I''d like to make sure that a user only sees/edits/creates entries in the
database that have the user_id
2006 Aug 14
4
Controller method problem
Hi,
I have a def in my controller see below where i want to find the page
object based on a parameter value and then use the page_id to then find
all the contents that belong to that page in the same method.
Controller
def aboutus
@page = Page.find_by_name(params[''About Us''])
@contents = Content.find(:all,
:conditions => "page_id = #{@page.id}")
end
2006 Nov 08
3
How to implement status codes in DB and Rails
This is more of a design issue I''m wrestling with, and was wondering
what other people are doing.
I have a products table with status values of In Stock, Out of Stork or
Discontinued. This is unlikely to change any time soon.
Approach A, is to have thses actual values in the status column, at
least the meaning is very apparent, yet querying for products with a
specific status could
2013 Mar 28
1
undefined method 'sanitize_limit' for #<ActiveRecord::Relation:0x2aaaad35d720>
I am trying to upgrate rails from 3.0 to 3.1, while updating rails version
I am getting following error
rake aborted!
undefined method `sanitize_limit'' for
#<ActiveRecord::Relation:0x2aaaad35d720>
/some_package/lib/ruby/gems/1.8/gems/activerecord-3.1.12/lib/active_record/relation.rb:460:in
`method_missing''
2010 May 12
16
In development mode not all types are included in the query related to type
class User
end
class Agent < User
end
script/console production
User.find_by_name ''john''
SELECT "people".* FROM "people" WHERE ((("people"."type" = ''User'' OR
"people"."type" = ''Manager'') OR "people"."type" = ''Agent'')) AND
2009 May 12
4
has_many :through and scopes: how to mutate the set of associated objects?
I have a model layer containing Movie, Person, Role, and RoleType,
making it possible to express facts such as "Clint Easterbunny is
director of the movie Gran Milano".
The relevant model and associations look like this
class Movie < ActiveRecord::Base
has_many :roles, :include => :role_type, :dependent => :destroy
has_many :participants, :through => :roles, :source
2006 Mar 12
3
Newbie: using find like a sql join query
I have a working Rails app with several related tables, but can''t find
an answer to this question in the Dave Thomas Rails book. Imagine for
example:
table departments with columns: id, department_name
table employees with columns: id, department_id, employee_name
and of course the employees table has a constraint foreign key
(department_id) references departments(id)
So this is
2009 Oct 08
6
Eager Loading a Relationship That Has No PK/FK
I''m attempting to wrestle an old DB into Rails.
This relationship is giving me trouble:
class Show < AR::Base
has_many :segments
end
class Segment < AR::Base
belongs_to :show
has_one :media #this has no PK/FK relation
end
A Segment is "linked" to Media by Media.name, which is the result of
concatenating Segment.name and Segment.part. As I said there are is no