search for: metaprogram

Displaying 20 results from an estimated 113 matches for "metaprogram".

Did you mean: get_program
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)
2011 Jul 16
2
[LLVMdev] select1st, select2nd
Chris Lattner <clattner at apple.com> writes: > The problem that I have with this sort of higher order metaprogramming Metaprogramming? This isn't template metaprogramming if that's what you mean. > in C++'98 is that you're trading one set of complexity for another. What's the other complexity? -Dave
2005 Dec 30
1
metaprogramming in controller: accessing instance variables
Hi all, I''m trying to move a bunch of methods out of a controller into a library that I can include and call a class method to have it dynamically add a bunch of methods to the controller. The goal is to just add to each controller: include UIEnhancements::SubList sub_list ''Note'', ''incomplete'' and have the sub_list method create all the methods
2007 Mar 24
1
spec''ing metaprograming & rails CRUD
For edge rails there is a Crud generator. There is also a CRUD controller that is out there from which you can inherit your other controllers (see http://geekonomics.blogspot.com/2006/07/crud-and- shared-controllers.html) This got me thinking about Crud controllers in general. As far as I know, the generator can''t produce crud classes which are nested (i.e.
2011 Jul 15
2
[LLVMdev] select1st, select2nd
Chris Lattner <clattner at apple.com> writes: > On Jul 15, 2011, at 12:35 PM, David Greene wrote: > >> I've run into a use case where I'd like to use a mapped_iterator to >> iterator the 1st (or 2nd) items in a sequence of std::pairs. Does >> select1st/select2nd exist somewhere within LLVM or is there some >> equivalent? If not, I'll add it. >
2011 Jul 16
0
[LLVMdev] select1st, select2nd
...but it results in a lot of code duplication when moving > DagInit to a uniqued pool implementation. I wanted to put the > processing code in a third function which would be called with various > types of iterators over those vectors. The problem that I have with this sort of higher order metaprogramming in C++'98 is that you're trading one set of complexity for another. Please just introduce a helper function or something and duplicate the loop. -Chris
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:
2006 Jun 01
5
History plugin
Hello, I felt annoyed enough when having to redirect user back to their previous location in a hackish way that I wrote this plugin. It avoids storing POST and Ajax request. It also has a facility to specify actions not to store in the history. If you are interested, it''s there: http://blog.cosinux.org/pages/rails-history See you all, Damien -- Damien MERENNE
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 Jul 17
0
[LLVMdev] select1st, select2nd
I'm talking about mapped iterator + select1st. -Chris On Jul 16, 2011, at 2:58 PM, greened at obbligato.org (David A. Greene) wrote: > Chris Lattner <clattner at apple.com> writes: > >> The problem that I have with this sort of higher order metaprogramming > > Metaprogramming? This isn't template metaprogramming if that's what you > mean. > >> in C++'98 is that you're trading one set of complexity for another. > > What's the other complexity? > > -Dave
2018 Mar 19
2
objc++ enhancements?
...ey can capture things like unique_ptr<> and still be moved off the stack 2) making @property declarations work with move-only types like unique_ptr<> 3) enabling std::weak_ptr<> to weakly store an objc pointer under ARC. (see radar: 31177975) 4) add a mechanism to allow template metaprogramming to make full use of selectors. (see radar: 30812297)
2010 Mar 10
5
Master thesis topic on Ruby or ROR
Hey fellows, I am a novice to ruby and ror, but really addicted to it. As a graduate student, I need master thesis topic around Ruby aor ROR. Can anyone suggest some for me? Regards/Buyan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
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.
2010 Mar 18
3
method_missing
i''m using method_missing to implement a simple metaprogramming that checks for account rights. in Account << ActiveRecord::Base i defined: def method_missing(m, a = {}) if m.to_s =~ /^has_right_(.*)$/ ... calls another method passing $1 parameter end end it seems to override some of the active record methods based on method missing. in the c...
2010 May 12
2
How to add an after_save callback on runtime on a particular instance
...instance with me. After this record is saved I want an after_save callback which would print the id of the record. The only catch is that I am not allowed to change the User class. How can I accomplish my goal? Is that even possible to add an after_save callback on a particular instance object. Any metaprogramming hack. I''m sure ruby does provide some tool. This would be a trivial issue if I were allowed to change the User class but I am not. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email t...
2011 Jul 23
2
[LLVMdev] Correct use of StringRef and Twine
...e, I hate having to force a choice between "convenience to implementor of an API to just take a StringRef" vs "convenience to client of API for it to take a Twine". It really stinks. I was chatting with Howard Hinnant about this and he suggested replacing Twine with a template metaprogramming expression-template system. I haven't thought through all the details, but perhaps this would allow us to get the best of both worlds? > Hmm, this is one bit I'm not sure about. As I tried to explain above, > it seems problematic to have to choose your argument type on the basis...
2011 Jul 24
0
[LLVMdev] Correct use of StringRef and Twine
...dev policy or preference around C-style casts versus C++-style casts? Twine is littered with the former but I generally use the latter for safety/clarity of intend, etc. (I'm not going to try to fix everything in Twine just now if we're considering alternative implementations like template metaprogramming anyway) >> As a side note on Twine's design: Is there a particular reason it uses >> void*s rather than unions? > > I'm not sure what you're proposing specifically. I've attached an version of my fix that includes the union use I was referring to (sorry for b...
2006 Jan 25
1
Protecting Your Apps against Cross Site Scripting Attacks
This has been in the news lately, so I wrote up an article about a method I use to protect my app against XSS attacks. It''s easy to use if you don''t care how it works, and I go through some of the metaprogramming techniques I used if you do. Check it out: http://blog.explorationage.com/articles/2006/01/25/how-to-protect-your-rails-apps-against-cross-site-scripting-attacks Justin
2018 Mar 19
0
objc++ enhancements?
...things like unique_ptr<> and still be moved off the stack > 2) making @property declarations work with move-only types like unique_ptr<> > 3) enabling std::weak_ptr<> to weakly store an objc pointer under ARC. (see radar: 31177975) > 4) add a mechanism to allow template metaprogramming to make full use of selectors. (see radar: 30812297) > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
2020 Mar 17
3
new bquote feature splice does not address a common LISP @ use case?
Dear R-devel, There is a new feature in R-devel, which explicitly refers to LISP @ operator for splicing. > The backquote function bquote() has a new argument splice to enable splicing a computed list of values into an expression, like ,@ in LISP's backquote. Although the most upvoted SO question asking for exactly LISP's @ functionality in R doesn't seems to be addressed by this