similar to: metaprogramming in controller: accessing instance variables

Displaying 20 results from an estimated 600 matches similar to: "metaprogramming in controller: accessing instance variables"

2006 May 26
0
Hellp needed with sublist plugin
Is there somebody out there who has built a working thingy with the Sublist plugin? I can''t get it to work. I get this error message: undefined method `stringify_keys!'' for "2005":String RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace E:/Programmeren/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1506:in
2008 Nov 13
3
metaprogramming with lm
Hello, Say I want to make a multiple regression model with the following expression: lm(y~x1 + x2 + x3 + ... + x_n,data=mydata) It gets boring to type in the whole independent variables, in this case x_i. Is there any simple way to do the metaprogramming for this? (There are different cases where the names of the independent variables might sometimes have apparent patterns or not)
2008 Jul 01
1
extracting elements from a list in vectorized form
Hi; It seems to me that has probably been asked in the past. But I cannot find the track. I usually need to extract elements from a list and contruct vector from them; e.g., to create a table. Perhaps there is a way to directly extract them without looping? Simple example: > S.lst $sublist.1 $sublist.1$age [1] 24.58719 $sublist.1$weight [1] 60.82861 $sublist.2 $sublist.2$age [1] 32.39551
2007 Jul 03
5
HOW TO: Easily output alternating item styles via metaprogramming
I always need to apply alternating item styles when outputting a collection, here''s what I''ve been using recently. In the app helper I define this method: def alternate(items,alt=false items.map{|i| i.class}.each { |k| k.class_eval {attr_accessor :alt}} items.each { |i| i.alt, alt = alt, !alt } end When I call the partial I wrap the collection with this method:
2010 Dec 21
5
Rails, Ruby, haml, metaprogramming problem
In HAML I have hundreds of lines like the following: - xyz = someFuncThatReturnsString(''xyz'') and elsewhere %div{''id'' => xyz} The above lines work fine. - - - Attempting to keep things DRY (Don''t repeat yourself) I want to do something like - eval(otherFuncThatReturnsString(''xyz'')) where
2011 Aug 04
2
How to extract sublist from a list?
Hi everyone, Suppose I have a list named "lst", see below: > lst $sub1 ... $sub1$x ... $sub1$y .... $sub2 ... $sub2$x ... $sub2$y ? $sub3 ... ... ... Now, I want to extract the sub-sublist $y from every sublist(sub1, sub2...) and then storage them to a new list. I know how to extract them by subscript or list name one by one, but I wonder if there exist some tricks to finish this
2010 Sep 22
2
efficient list indexing
Hello everyone, I need some help with lists inside lists (a good way to emulate a struct)\ Assume that there is a small list called fred: fred <- list(happy = 1:10, name = "squash") and a big list called bigfred that includes fred list 5 times bigfred <- rep(fred,5) Is it possible somehow to index all these sublists(fred) inside bigfred with a more direct way like this:
2007 Feb 22
3
List filtration
Hello R-ologists, Imagine you have a list "list" like so: >list [[1]] [1] "IPI00776145.1" "IPI00776187.1" [[2]] [1] "Something" "IPI00807764.1" "IPI00807887.1" [[3]] [1] "IPI00807764.1" [[4]] [1] "Somethingelse" What I need to achieve is a filtered list "list2" like so: >list2 [[1]] [1]
2006 Nov 04
0
traits-0.9.2 - better living through metaprogramming
URLS http://rubyforge.org/projects/codeforpeople/ http://codeforpeople.com/lib/ruby/traits ABOUT traits.rb is set of attr_* like methods on steroids, caffeine, and botox. it encourages better living through meta-programming and uniform access priciples. traits.rb supports smart inheritence of class attributes and a fistful of hooks for veryifying and munging attr values.
2008 Nov 04
2
strange list structure question
my problem is more complex than below but I think below can suffice. i have a list and the name of it at the top level is GGG. so, if i do an lapply and operate on lower components in the sublist, then I can do as shown in EXAMPLE 1 and what will come back will be named GGG at the top level. but, suppose that , the function inside the lapply function was more complex and i wanted to
2012 Dec 22
1
plotting and saving diagrams automatically
[if the format of my email is changed or is difficult to understand, a text file is attached for easy understanding]Dear useRs, i was wondering that if its possible in R to automatically generate plots and get it saved at the desired location? i have data of cancer patients, from about 1000 cities around the world. i have converted that data into a list (called tcp) and that list has 1000
2015 Apr 22
2
semi-OT: t-bird mime type on .pdf attachment is wrong
I was sending my manager a copy of a form, and attached it (not inline), using -t-bird, and he complains it didn't want to open. Looking at the message source, t-bird had decided that the mime type was all/allfiles, though the name ended in .pdf. I've searched via the config editor, and I've been googling, and not finding anything. (I just *adore* the current google: I have
2004 Aug 16
1
* and answering machine
I'm using * at home and I planned on having * let the answering machine in my kitchen to the "general" voicemail getting. However, about 6s into the call * will hang up the line. I found a post about OHT somethingorother, so I can probably work around it, but I'd like to know what's happening and if there's a better way around. Thanks! -- -M There are 10 kinds of
2005 Jun 06
1
rsync and ~/.wine
Hi All With winetools 2.12 and the 2004-10-somethingorother release I'm finally able to 'use' wine with some industry specific little applications. [THANKS Joachim for making other's hard work so useable! I've been wanting to do this for ever and never got it to work previously. ] So, I've installed wine, winetools and a half dozen Windows applications. I'd like
2015 Apr 23
1
semi-OT: t-bird mime type on .pdf attachment is wrong
Tris Hoar wrote: > On 22/04/2015 19:25, m.roth at 5-cent.us wrote: >> I was sending my manager a copy of a form, and attached it (not inline), >> using -t-bird, and he complains it didn't want to open. Looking at the >> message source, t-bird had decided that the mime type was all/allfiles, >> though the name ended in .pdf. I've searched via the config editor,
2012 Feb 21
1
firefox and IronPort
A couple of weeks ago, I got an autogenerated email from the mail folks here, telling me they'd quarantined what they thought was spam. The last time I got one of these was a month or month and a half ago, and I had no problem. This time, however, I get a 500 error. When I pulled up firefox's error console, and clicked on the link, I got <servername elided>: server does not support
2005 May 14
6
HELP!! Serious memory leak in my rails app!!
I''m having a huge memory leak problem with a rails application I''m developing! I first noticed that when running under webrick (via script/server) there was a fast memory leak.. several users using the app for a few hours would use 2 gig of memory!!! I searched the archives and found that some users found that it could be avoided by saying --daemon when launching webrick..
2016 Jan 27
4
Just need to vent
Sylvain CANOINE wrote: >> De: "Jonathan Billings" <billings at negate.org> >> Maybe you're not aware of it, but there are a LOT of things that >> systemd fixes that people are happy about. > Like what ? I don't remember there were as many errors to fix before > systemd appeared. > Agreed. The speed of boot and shutdown? Whoop-de-do. I've got
2011 Oct 14
3
Split a list
I have a list of dataframes i.e. each list element is a dataframe with three columns and differing number of rows. The third column takes on only two values. I wish to split the list into two sublists based on the value of the third column of the list element.  Second issue with lists as well. I would like to reduce each of the sublist based on the range of the second column, i.e. if the range of
2006 Jul 02
4
:order in partial
Hi, i was looking through the docs and couldn''t find a good clean solution for ordering a partial with an :order clause. say i was iterating over categories and thier corresponding sub-categories (regular belongs to) and wanted to order the subcategories according to a certain column; <% for category in @categories %> <% render: partial => ''sublist'',