Displaying 20 results from an estimated 7000 matches similar to: "RoR: recognizing a defined class"
2006 Aug 10
6
save without commit ?
How do I get ''save'' to execute without commit?
I have tried:
ActiveRecord::Base.connection.begin_db_transaction
# do some stuff that doesn''t issue a database COMMIT statement
# then:
@myObject.save
# this issues a COMMIT but it shouldn''t! Shouldn''t it wait until I''ve
called:
ActiveRecord::Base.connection.commit_db_transaction
?
what am
2009 Nov 23
1
OOP with Encapsulated Class Definitions
Hi all,
I'm seeking feedback (good, bad or indifferent) in regards to
developing (further) a new class system for R, that uses encapsulated
class definitions (i.e. the method definitions are literally inside
the body of the class definition).
A working (however very rough and poorly tested) system is available
in my R package "oosp" with documentation in the vignette
2006 Jun 21
26
Implementing a boolean "switch" in a Class
I need a single boolean which would be "globally" accessible to all
instances of a class. Seems like the boolean should be in the class
prototype, but I was troubled by the difficulty of setting the prototype
boolean to true. Maybe I''m missing something?
var MyObject = Class.create();
MyObject.prototype = {
bSwitch: false,
... other methods and properties
}
var oMyOb1
2006 Dec 12
1
S4 'properties' - creating 'slot' functions?
Dear R users!
Several languages like C# or VB allow one to create properties; typically
these are under 'get', 'set' tags. My question is this really, what are
similar or comparable strategies in R, and what might be preferred? I have a
couple of situations where I want a certain computation to belong to a
class, but I do not really want to seperate it out to a stand-alone
2008 Jan 09
1
Subsetting Method [ Revisited
Hello Everyone:
As usual, thanks in advance for any help.
I was hoping to get some more advice on this question:
I'm trying to write a subsetting routine for an S3 object I've created --
lets call it myObject.
myObject has a few attributes basically of type string and numerics. Its
atomic value is just a vector of ints.
I want to write my own subsetting routine to subset myObject in
2003 Oct 22
2
Automatically updating GLM object
Dear all,
i generated several GLM objects, named myobject1 to myobject25.
Now i'd like to update both of them.
So i tried:
for(ii in 1:25) {
assign(paste("myobject.updated", ii, sep=""), update( myobject[ii]
,.~ + VAR2))
}
Doesn't work
I also tried to get all the names in a vector and
update(names.myobject[ii],.~ + VAR2)
Stiil doesn't work
Any ideas
2006 May 24
2
newbie oo question
Hey everyone,
I''m trying to create an object that will have some properties
predefined, but will allow me to pass in properties to override those
standard props if needed. I''m trying something like:
var myObject = Class.create();
myObject.prototype = {
initialize: function(element, options) {
this.element = $(element);
this.name = this.element.id;
this.options =
2006 Feb 17
2
Sorting Multiple Arrays
Hey Cats,
I''m having a problem. I''m working with an object that contains a bunch
of arrays:
var myObject = {
"data": [
{"line": [1,"aoo","far"]},
{"line": [2,"boo","ear"]},
{"line": [3,"coo","dar"]},
{"line":
2006 Aug 04
9
Mongril or Lighthttttp? Yes
I was writing my blob at http://railsblob.blogspot.com/ which is for new
people who are new to Rubby and I was learning if Mongril or
Lighthttttp? or Web Rick is better for me. Have you any advice. Thanks?
Rails Blobber
--
Posted via http://www.ruby-forum.com/.
2007 Jan 22
1
Prototype.js object.constructor exception
I''m trying to debug an a uncaught exception: Permission denied to get
property Object.constructor error.
I have some code like this:
myObject.js
------------
function myObject (arg1, arg2, arg3)
{
//does some constructor related stuff
}
myObject.prototype.createSomething = function()
{
// do more boring stuff
// return an Array;
}
manager.js
-----------
var fakeHashMap = new
2009 Oct 22
1
how to create a new data type
I am working on a new package to do fire department analysis. I am working
with emergency dispatch data from different agencies that all contain the
same information but have slightly different formats. Typically the
variable names and date-time formats are different. I am getting pretty
good at reading in and rearranging the data so that it is essentially in the
same format, but it is common
2005 Jul 19
2
Obtaining argument name within a function
Dear all
How can I obtain the name of the argument passed in a function? Here is a
simplistic example of what I would like to obtain:
myfunction= function(name) {
print(paste("The parameter name was",unknownFunction(name))
}
myfunction(myobject)
[1] "The parameter name was myobject"
Thanks
Francisco
2006 Dec 30
1
plot methods in sp
Dear listers,
I am working since a while with the sp package and still wonder how the
plot methods are managed with sp spatial objects. For instance,
SpatialPolygonsDataFrame objects have obviously a plot method. However
it cannot be found in the list provided by methods(plot) . Furthermore
?plot.SpatialPolygonsDataFrame, nor ?plot.SpatialPolygons, etc.. provide
a help, though the lattice
2019 Jul 07
3
Possible bug in `class<-` when a class-specific '[[.' method is defined
Hi all !
I noticed a strange behaviour of the function `class<-` when a class-specific '[[.' method is defined.
Here below a reproducible example :
#-------------------------------------------------------------------.
counttt <- 0
`[[.MYCLASS` = function(x, ...) {
counttt <<- counttt + 1
# browser()
x = NextMethod()
return(x)
}
df <- as.data.frame(matrix(1:20,
2012 Sep 18
2
Access block scope from AR object
I need to create a sort of transaction around some Active Record objects
that perform many insert/updates.
Example:
class MyObject
def transaction &block
@my_var = value
self.instance_eval block
end
end
MyObject.new.transaction do
Model.create
Model.collection.create
etc......
end
I have a gem that add a method into AR::Base and I need to read
2004 Nov 18
5
Lexical Scoping: eval(expr,envir=)
Hi R-listers,
I am trying to better undertand what we would call "functional paradigm"
use of S/R to better map my programming activities in other languages.
This little function is aimed to create an object (at the end end, it would
have it's own class):
--
myObject =function(){
list(
a=1,
foo=function(b)
{
cat("b:",b)
2005 Sep 18
5
NameError: uninitialized constant Addres
I created some scaffolding for an Address model and an Addresses controller.
When running the functional tests for the addresses controller, I get
this exception: "NameError: uninitialized constant Addres"
The exception seems to start from this function:
def list
@address_pages, @addresses = paginate :address, :per_page => 10
end
I''m guessing pluralization bug?
2006 Jan 24
5
simple formmail question
I have a few forms that I''d like users to fill out. The results of
the form will be sent to a few addresses.
What''s the least painless way to do this and keep everything DRY?
There''s no database involved. Ideally, I''d like to email the form
questions with the answers inline.
Seems like using ActionMailer and separate email views would be
overkill in this
2006 Jan 14
11
accessing models from migrations
Ok, so now Users need to be associated with Organizations. I''ve
created a migration and added a ''organization_id'' column to the users
table. I want the default organization_id to be the first
Organization. So I have :default => Organization.find(:first). But
it''s complaining about not being able to find the constant
''Organization''.
Any
2006 Aug 04
14
Printing an Order
Can Rails be used for printing an order in a store application that has
arrived?
--
Posted via http://www.ruby-forum.com/.