search for: myobject

Displaying 20 results from an estimated 60 matches for "myobject".

Did you mean: pyobject
2006 Aug 04
2
RoR: recognizing a defined class
Hi all, I am very new to Ruby and I have a silly question: how do I get RoR to "recognize" that I just defined a class? To be more explicit, I have a controller and view, and then I want to create a class and get the controller to "see" it. So, I created a file called "myobject.rb" in the models/ directory and inside it defined "class myobject [...] end". However, if I put code inside the controller that wants to create a new object myobject.new, it says "undefined constant myobject". Any suggestions why Rails doesn''t "see" the...
2009 Nov 23
1
OOP with Encapsulated Class Definitions
...A working (however very rough and poorly tested) system is available in my R package "oosp" with documentation in the vignette "oosp2_Encapsulated_Classes_in_R". A snippet of a class definition follows: (Here double is a method that doubles the value of the attribute x). > MyObject = function (...) { MyObject = function (x) .$x = x double = function () .$x = .$x * 2 mclass () } A snippet of creating and using an object: > myobject = MyObject (10) > myobject$x [1] 10 > myobject~double () > myobject$x [1] 20 Here class definitions are functions, however...
2006 Mar 28
0
Question about Mapping from Forms
During a load or save in my controller I''ve manually been doing: @myobject = MyObject.find(:first, :conditions => "id = #{@params[''id'']}") If I''m updating an existing object I load it, change stuff using something like myobject.name = "@params[''name'']", etc etc, then call save. That''s what I...
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 = new MyObject(); var oMyOb2 = new MyObject(); alert(oMyOb1.bSwitch); // reports false alert(oMyOb2.bSwitch); // reports false Now set the value of bSwitch to true so all the oMyObN'&...
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],.~ + V...
2006 Dec 12
1
S4 'properties' - creating 'slot' functions?
...ere are a couple of options I see possible in R, and if I use the last described option (see option C below), is there a way to access the object with something like in C# or C++ where one would probably use the 'this' keyword or the 'me' keyword in VB from within the property?: A) MyObject@Property is static and must be handled carefully if it depends on other slots of the class. If one of the slots changes, then because this slot is static (containing only the value), it will not change to reflect the update. B) MyObject@Property is deprecated, and special accessor functions are us...
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 an unconventional way. So my method looks like this: "[.myObject" <- function( obj, i, j, ...){ ..... p...
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": [4,"doo","car"]}, {"line&qu...
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 = Object.extend({ data: eval(this.name + ''Data'') }, options || {}); }, What I want is the this.options.data pr...
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) cat("\na:", a) } ) } -- To my minds, "a" would be a property of the object and "foo" one of it's method. Let instantiate one version of this obj...
2006 Jun 17
2
problem with select_date
In my form I have these items: <%= select_year Date.today, :start_year => Schoolyear.get_startdate.year, :end_year => Schoolyear.get_enddate.year %> <%= select_month Date.today.month %> No matter what I do, in my controller I can''t seem to access the selected year and month. I have tried params[:month].to_s and also
2006 Dec 12
0
S4 property slots as functions?
...ere are a couple of options I see possible in R, and if I use the last described option (see option C below), is there a way to access the object with something like in C# or C++ where one would probably use the 'this' keyword or the 'me' keyword in VB from within the property?: A) MyObject@Property is static and must be handled carefully if it depends on other slots of the class. If one of the slots changes, then because this slot is static (containing only the value), it will not change to reflect the update. B) MyObject@Property is deprecated, and special accessor functions are us...
2008 Nov 04
18
Can I do foo.should (be_nil || be_empty) in rspec
Is there any way to do foo.should (be_nil || be_empty) in rspec. Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081104/ee43c9c9/attachment.html>
2005 Nov 23
8
getting started, reading listing and saving data
Dear List I am new to R and to the list and will try best as I can be clear and concise. My apologies if anything I write contravenes the posting code on this list. I would also like to say I have run through most of the material on the R website before writing this email however, I am stuck. Here is what I want to do and what I have done 1. Read a comma seperated text file into R I have used
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
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 Object(); fakeHashMap[''newmyobject'']...
2006 Dec 30
1
plot methods in sp
...onsDataFrame 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 function spplot is adequately documented. On the other hand, plot(myobject, border="grey"), with myobject a SpatialPolygonsDataframe is well interpreted and recalls the syntax of plot.polylist of matools (though myobject is far from being a polylist...). Can anybody (especially the package's authors...) comment on this? Where a help with the list of the...
2011 Jun 10
2
merge large number of raster objects
Hello, I have a large number of raster objects in memory, with names RH100, RH101, RH102, etc. (myobjects <- ls(pattern='^RH')). These rasters are sections of a continuous map, and I would like to combine them using the RasterObject merge tool in package 'raster.' Merge expects an input list of raster objects (outmap<-merge(x, y, ...), where x, y, and ... are raster objects)....
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 the variables setted by the tr...
2006 Apr 06
2
Finding out the format of an object
Suppose I have an arbitrary R object. Is there a way to find out its format? There are 118 points, each described by two numbers. Let the name of the object be "obj" without the quotes. I can do a print (obj), but all I get is a bunch of numbers. I can do a ls.str (obj), but all I get is a bunch of numbers. Is it a data frame? A vector with 118 elements, each having two