Displaying 20 results from an estimated 1500 matches similar to: "newbie oo question"
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":
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 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".
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 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
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)
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
2006 Jun 27
5
Ajax - Inserting selected elements from request.responseText
After retrieving a URL using an Ajax.Request...
function onComplete (request, json) {
// request.responseText holds the entire page
Only the content contained in elementID = ''source'' is intended for display
At this time, the following code works, but it disturbingly copies the
entire page from the source URL into the target DIV
$(''target'').innerHTML =
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
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
2010 Feb 07
3
using a variable name stored in another variable?
Hello,
I'm trying to figure out how to create a data object, and then save it
with a user-defined name that is input as a command line argument. I
know how to create the object and assign it the new name, however, I
can't figure out how to refer to the new name for a future operation
such as save(). The code below creates an object and uses assign() to
give it the user supplied name
2010 Nov 22
1
cpgram: access data, confidence bands
Dear R experts, beginners and everyone else,
I'm calculating "cumulative periodogram" using the command "cpgram"
[1] from the MASS library. Here is a short example with the "lh"
(hormone level) dataset:
library(MASS)
plot(lh,type="l",ylab="value",xlab="time", main="Hormone Levels (lh)")
spectrum(lh,
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>
2006 Jan 30
5
Multiple ajax calls
This is slightly OT for which I apologise in advance, but I was
wondering if anyone here has had any problems when making multiple
ajax calls at the same time. I''m working on a large Intranet
application which makes heavy use of ajax calls and the bugs are
flying in from the testers that if they repeatedly click on a link
that makes an ajax call then Internet Explorer can fall
2006 Apr 10
1
RE: Prototype Ajax - How to pass my own params toonComplete ?
You need a closure.
onComplete: function (response) { NamedActionResponseHandler(theElement,
response); }
Is that what you mean?
Greg
> -----Original Message-----
> From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-
> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Erin Brewer
> Sent: Monday, April 10, 2006
2010 Jul 08
3
Testing equality
Hello
How can I test equality with two objects when they include some
attribute that is BigDecimal?
if I make something like this:
it "should ...whatever" do
obj = Factory.create(:my_object)
...
MyObject.first.should == obj
end.
FAILS
This fails because the object expected is different from the object
gotten, and the only difference are the BigDecimal attributes, that are
2006 Jun 19
10
Trying to delete from a unordered list using ajax
I have a controller method as such:
def delete
@category = Category.find_by_name(params[:name])
@element_id = @category.name
Category.delete_all(["name = ?", @category.name])
end
(For the purpose of this exercise, category names are unique)
I have the corresponding delete.rjs file:
if @element_id
page.remove :id => @element_id
page.visual_effect :highlight,