Displaying 20 results from an estimated 3000 matches similar to: "The use of period in function names and variable names"
2011 Aug 29
2
Problem in writing a R data frame to Excel format using RODBC package
Hi Experts,
I was trying to write a data frame which has a header row,
from R to Excel disk file using RODBC ( RODBC_1.3-1) package. I met with an
issue:- If in sqlSave(), I set a parameter "colnames=FALSE" then I get
first row as header in excel file. If 'colnames=TRUE' then it gives me first
2 rows as header in excel file.
Actually, according to my
2007 Mar 30
7
problem with using any_instance
Hey all,
I have a question with using mocha in my tests.
In the same test file, I have two tests,
<code>
def test_a
klass.any_instance.stubs(:method_name).returns("something")
klass.new.method_name
...
end
def test_b
...
klass.new.method_name
...
end
</code>
where klass is some class
when the tests run, test _a passes, but test_b had an error like this:
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
On my current project I needed to create a stub that responded
correctly to the id message. Here''s the change I put into my copy of
head.
Index: lib/mocha/mock_methods.rb
===================================================================
--- lib/mocha/mock_methods.rb (revision 1114)
+++ lib/mocha/mock_methods.rb (working copy)
@@ -68,6 +68,7 @@
method_names =
2006 Apr 20
11
dynamic mock object anyone?
Hi guys, got this problem with creating such a thing... hope anyone
could help..
the problem:
ok, now i have this mock object that would simulate a external rpc call.
eg
require ''models/xmlrpc_agent''
class XmlrpcAgent
def create(params)
200
end
end
but the value of the value returned is fixed. which is quite hard for me
to test the controller when different
2006 Aug 06
2
help with method_missing in ActiveRecord
I am serializing a data object (FooData) into an ActiveRecord column (Foo).
I''d like to be able to do delegate methods to the data class if the Foo
class doesn''t have that attribute. So instead of:
f = Foo.new
f.data.item1
I''d like to do:
f = Foo.new
f.item1
I was hoping that I could add a method_missing method to my Foo class and
call methods in the FooData class
2006 Aug 09
2
How do you define a method
Hi all,
I was wondering if anybody could help me figure why a view cannot find a
method that I defined in another class. I do this in the view: (let''s
say index.rhtml)
<%= check_box("item_search_page", "method_name")
Here, item_search_page is a variable in the view''s controller, which
creates a new ItemSearchPage object. And I defined
2007 Mar 04
4
Rails functional testing and Mocha
I''ve always wanted to be able to do stuff like this in my functional
tests
c = customers(:customer_1)
c.expects(:great_customer_service)
post :service_customer, :id => c.id
This of course fails because inside the rails action a different
instance of customer is used. Some of the time setting your
expectation/stubbing on Customer.any_instance works, but it''s not
2006 Jun 26
4
why can''t I call this without parentheses?
I have a little helper that lets me add legacy fields to models where
they have common prefixes, suffixes, or something else weird. Here is
the method signature:
def legacy_fields(options = {}, *attributes)
.....
end
options is a hash containing things like :prefix => "post_" - and
attributes is a list of attribute names. This gets mixed into the
class with extend, so I call
2007 Dec 08
6
Rails 2.0 ActionMailer breaks my redmine render_message
I am using ''redmine'' (v 0.6) as my major project manager, seems running
fine w Rails 2.0 (slight modifs for paginations..) but I am stuck with a
major error when sending a confirmation email :
mailer.rb
class Mailer < ActionMailer::Base
....
# Renders a message with the corresponding layout
def render_message(method_name, body)
layout =
2014 Oct 13
16
[LLVMdev] RFC: variable names
I’d like to discuss revising the LLVM coding conventions to change the naming of variables to start with a lowercase letter. This should not be a discussion on the pain of such a transition, or how to get from here to there, but rather, if there is a better place to be.
My arguments for the change are:
1. No other popular C++ coding style uses capitalized variable names. For instance here
2005 Nov 30
3
Downcasing Legacy Table Column Names
I''m looking for the simplest way to *automatically* downcase the
attribute names of Models mapped to legacy tables that use upper
case. eg:
class Workorder < ActiveRecord::Base
set_table_name "WORKORDER"
end
which has "NAME" as an attribute can use "name" as an attribute.
currently:
workorder = Workorder.find(1)
workorder.NAME # =>
2009 Apr 13
4
Creating Methods in the Model?
Hey Everyone.
First day diving in to ROR and Ruby...
My question is how do you define methods with in the model class and/or
should I even be doing this?
It is my understanding that you should put as much of the business logic
into the model as possible. I want to do some data manipulation before
I things are submitted to the database
IE (Create a variable out of two submitted via form, as
2011 Oct 29
1
Add col in data.frame
Hello Gurus,
I am still new to R. Here is my issue.
I was trying to add column to data frame that was populated by read.spss().
When I used cbind to add a new variable(column).
library(foreign)
mydf<-read.spss(file="C:/myspss.sav",use.value.labels=FALSE,
to.data.frame=TRUE,use.missings=FALSE)
attr(mydf,"variable.labels")
## it gives you all the labels
2006 Aug 19
5
Form helpers don''t work with facade columns?
Hello all,
I''ve been trying to use a facade column but I notice that the form
helpers don''t seem to respect the facade.
In the following example I''m trying to story the prices as Integer
values but present them to the user as decimals.
class Product < ActiveRecord::Base
def price=(new_price)
write_attribute(:price, Float(new_price)*100)
end
def price
2006 May 18
3
populating array of text_fields from an array of model objects
I have in my view the following:
<% 0.upto(@num_performances) do |idx| -%>
<%= text_field ''performance'', ''city'', :index => idx, %>
<%= text_field ''performance'', ''venue'', :index => idx, %>
<% end -%>
and in my controller I have:
@performance = [Performance.new("city" =>
2013 Apr 15
6
how to transform string to "Camel Case"?
Dear all,
Given the following vector:
> (z <- c('R project', 'hello world', 'something Else'))
[1] "R project" "hello world" "something Else"
I know how to obtain all capitals or all lower case letters:
> tolower(z)
[1] "r project" "hello world" "something else"
> toupper(z)
[1] "R
2006 Sep 22
2
foo.expects(:blah).returns(10).then(11) syntax
I recently needed the behavior of my object to change on subsequent
method calls so I added the syntax above.
Here''s the diff of changes I made:
Index: test/mocha/expectation_test.rb
===================================================================
--- test/mocha/expectation_test.rb (revision 854)
+++ test/mocha/expectation_test.rb (working copy)
@@ -95,6 +95,12 @@
2019 Feb 03
4
Variable names rule
> On Feb 2, 2019, at 8:18 PM, Chris Lattner <clattner at nondot.org> wrote:
>
>
>
>> On Feb 1, 2019, at 6:20 AM, Michael Platings via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>> Hi all,
>>
>> As application of the naming rules are currently under discussion [1] this seems like a good time
2012 Mar 27
16
[PATCH 01/16] generator: Fix unescaped '<' and '>' in api descriptions
---
generator/generator_actions.ml | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index 68a7bf6..fcf363f 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -4664,7 +4664,7 @@ This creates an ext2/3/4 filesystem on C<device> with
an external journal on
2006 Feb 16
10
Confused over Model attrbutes and @ prefix
I''m confused about how attributes work in models. For example:
class Page < ActiveRecord::Base
attr_accessor :body
def foo
id # works
@id # won''t work IIRC
body # won''t work
@body #works
end
end
Why doesn''t everything work the same?
Joe
--
Posted via http://www.ruby-forum.com/.