Displaying 20 results from an estimated 500 matches similar to: "how to add a method without coding it directly into app?"
2006 Jun 26
5
How can I dynamiclly generate models?
I am trying to write a plugin, ''acts_as_commentable'', for my models -
Image, Book, Music and so on, I do not want to use polymorphic
association, so very model should have its own comment class.
Here is my code
acts_as_commentable.rb
module Commentable
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def
2007 Sep 18
2
Making attachment_fu polymorphic
I am working on a small model mixin called attachment_kung to make
attachment_fu polymorphic, so you no longer need a different table and
Model class for every associated attachment (Productimage, Ad_doc,
etc). All you really need is one model and table to handel all your
attachments - in some cases, anyway. I have the code working, but have
run into one small hitch that I can''t seem to
2008 Jun 03
8
@@state_secret
I was having some issue getting the class variables in
Camping::Session to work with some old apps, so I''ve changed
@@state_secret to a method.
module Blog
include Camping::Session
def state_secret; "kxxxx" end
end
Also, merged some of zimbatm''s patches. And trying to revive the
Junebug wiki <http://github.com/why/junebug> since it''s still
2006 Jul 28
0
reserved words
I''ve seen this topic has been discussed a couple of times. However, I''m
wondering if a method exists in rails to test a name against the reserved
words listed on the wiki?
Just wanted to check before I write this myself (and type in all of those
names -- including PostgreSQL).
To explain the application:
I''ve written a project that manages ldap data. On a fresh
2008 Jan 04
3
Can''t access my data
Hi Folks..
I have/had a zpool containing one filesystem.
I had to change my hostid and needed to import my pool, (I''ve done his
OK in the past).
After the import the mount of my filesystem failed.
# zpool import homespool
cannot mount ''homespool/homes'': mountpoint or dataset is busy
The data seems it might still exist, (correct amount of used space is
reported),
2007 Nov 06
4
help on helper module inclusion/extension
I want to include helper methods included to my Camping App from by
requiring an external file but I can''t seem to include helpers from
another module.
module CampingHelpers
def self.included(base)
base::Helpers.send(:include, Helpers)
end
module Helpers
def show_test
p "test"
end
end
end
Camping.goes :CampingApp
...
module
2007 Nov 21
2
where do i get the return value of a javascipt method?
how do i get the value of a javascipt confirm() function?
a(:href=>R(DeleteUser, @user.id), :onclick => "javascript:confirm(''You
sure about this?'')"){label}
any tips?
thanks!
--
|^^^^^^^^^^^^\ .||
|NALDEVNGELSTA.___||''""|""\___,
| ________________ l | |__|__|_|)
(@!)!(@)"""""**|(@) (@)****|(@)
2008 May 08
1
query strings built by R method can''t handle multiple values from checkbox selections
query strings built by R method can''t handle multiple values from checkbox
selections
R(SomeRoute, :reply_status=>%w{1 2 4})
should return
query_string="
http://localhost:3301/someroute/?reply_status_id=1&reply_status_id=2&reply_status_id=4
"
qsp(query_string) -> {"reply_status_id"=>["1", "2", "4"]}
from
2006 Jan 09
4
How to carry parameters to a new page?
Hello,
I have a page where user can register him/herself to the site.
If the user enters something wrong, or leaves blank textboxes, I want to
reload the page and tell the user what went wrong. Also the
textbox-values the user already entered, should be kept in the
textboxes.
For example, in my user-controller:
if @username.length == 0
redirect_to :action =>
2007 Jan 02
1
How to extract the variance componets from lme
Here is a piece of code fitting a model to a (part) of a dataset, just
for
illustration. I can extract the random interaction and the residual
variance
in group meth==1 using VarCorr, but how do I get the other residual
variance?
Is there any way to get the other variances in numerical form directly -
it
seems a litte contraintuitive to use "as.numeric" when extracting
estimates,
2009 Nov 17
2
Lattice plot
Hi,
I was trying to get a graph in lattice with the following data frame (7 rows, 5 cols):
chr start1 end1 meth positive
1 1 10 20 1.5 y
2 2 12 18 -0.7 n
3 3 22 34 2.0 y
4 1 35 70 3.0 y
5 1 120 140 -1.3 n
6 1 180 190 0.2 y
7 2 220 300 0.4 y
I wanted the panels to be organized by 'chr' -
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
Interrogating some (of my own) code in another package.
>norm.meth <- getMethod("normalize", "MatrixLike")
>message("str(norm.meth)")
>str(norm.meth)
>message("show(norm.meth at .Data)")
>show(norm.meth at .Data)
Last show() displays this:
function (object, ...)
{
.local <- function (object, method = c("median",
2023 Feb 23
1
Compilation Error when DEBUG_approx Toggled on in RISC-V
Hi all,
While compiling R to RISC-V64 architecture and debugging in R's C source
codes, I think I have found a small bug. Can anyone please verify whether
it is a real bug?
The possible bug lies in the file `R-4.2.2/src/library/stats/src/approx.c`
in function `R_approxfun` around line 148:
#ifdef DEBUG_approx
REprintf("R_approxfun(x,y, nxy = %.0f, .., nout = %.0f, method = %d,
2013 Aug 21
1
Bug in dovecot 2.2.5: segfault due to bad alignment
Take a look at the sources, hmac.h declares struct hmac_context:
struct hmac_context {
char ctx[HMAC_MAX_CONTEXT_SIZE];
char ctxo[HMAC_MAX_CONTEXT_SIZE];
const struct hash_method *hash;
};
If compiled for a 32 bit virtual address space, this has an alignment
requirement of 4 due to the hash pointer.
In line 171 of auth-token.c, we have following
2015 Jan 28
2
[Q] Get formal arguments of my implemented S4 method
I'm attempting to reflect the information for use with corresponding
fields in GUI (in a different package), to provide default values,
argname as key for UI label lookups, etc.
So I want something much more like the formals of the implementation:
{
"object",
"method": c("median", "vs", "tukey"),
2010 Sep 20
1
Please help with this error - new to
I am getting the following error in my script. I am very very new to R and
have obtained this script from another person.
#read file in (dummy data)
starburst.plot<-function(affy.fold, affy.FDR)(ifelse( ((affy.fold) >=0),
-1*log10(affy.FDR), 1*log10(affy.FDR)))
starburst.plot<-function(meth.fold, meth.FDR)(ifelse( ((meth.fold) >=0),
-1*log10(meth.FDR), 1*log10(affy.FDR)))
At my next
2007 May 07
3
Module Madness
I''m wanted to make a "global" module that I could include in my
application for some shared code between them. I''ve been making
several camping apps and wanted them all to share a helper/partial
that contained the navigation.
I ran into a lot of difficulty when trying to include it, the primary
problem being "methodUndefined" errors. I did finally get it to
2012 Sep 04
2
[PATCH] Generalize HMAC implementation
Hello everyone and Timo in particular,
about a year ago I implemented a SHA-1 variant of the HMAC(-MD5) present
in Dovecot.
I had always disliked this a bit, because it replicates a lot of code.
This patch generalizes the HMAC function to take a hash_method struct as
parameter, and changes existing code which uses the "old" HMAC function
to use this new one.
I'm not really sure
2008 May 28
3
Plug-in support for Camping Apps
# camping_plugin.rb
# plug-in support for Camping Apps
# require ''lib/camping_plugin''
# override R helper method to your liking :-)
module Camping
module PluginHelpers
def R_with_module(c,*g)
p,h=/\(.+?\)/,g.grep(Hash)
g-=h
raise "bad route" unless u = c.urls.find{|x|
break x if x.scan(p).size == g.size &&
2006 Feb 01
4
Custom view helpers
Hi all,
I would like to write some custom helpers like the ones available as
form helpers text_field, text_area and the like. My first try was this:
custom_helper(obj, meth)
''some_string'' + obj.send(meth) + ''some_other_string''
end
Object and method are being passed as symbols like this:
custom_helper(:person, :name)
and Ruby rightfully complains that