I love blog posts biased toward the mormon faith, being one myself.
http://religionus.blogspot.com/2008/05/united-states-church-membership.html
“all is well in zion”
“zion prospereth”
-=R
I love blog posts biased toward the mormon faith, being one myself.
http://religionus.blogspot.com/2008/05/united-states-church-membership.html
“all is well in zion”
“zion prospereth”
-=R
So it turns out that if you override Symbol#to_proc in rails in a file which you “load” from the console…welll—it doesn’t work. If, however, you load it from environment.rb then it works.
ex:
This allows you to do:
a = Program.find(:all)
a.map &:school__name # double underscore
=> ['school name', 'school name']
a.map &:name_and_code
=> [['program 1 name', 'program 1 code'], ['prog2 name', 'prog2 code']]
class Symbol
alias
ld_to_proc :to_proc
def to_proc
me = self.to_s
if me =~ /_and_/
first, second = me.split('_and_')
proc {|obj, *args| [obj.send(first, *args), obj.send(second)]}
elsif me =~ /__/
first, second = me.split('__')
proc { |obj, *args| obj.send(first, *args).send(second) }
else
old_to_proc
end
end
end
Hard to find some high quality gruff examples–well here they are!
http://wilkboardonline.com/roger/p2p/gruff_examples/output/
so…mysqlplus has a new all_hashes. It’s faster. Like 5% faster.
Now add slim-attributes [pennysmalls.com]
It’s faster [esp. with many columns, but even with fewer]
to the tuns of
@utime=2.66>
@utime=0.37>
wowza
121_000 line query
However–this seems to only help for many column db’s and only for the load time for very very large queries–which is probably not the bottleneck [but it does help--esp. if you have monster queries].
svn co svn://rubyforge.org/var/svn/mongrel/trunk mongrel_trunk
cd mongrel_trunk
vi lib/mongrel/handler.rb # go to line 207 or so and change all the “: false” to “then false”
sudo ruby setup.rb
done!
In Python, you can pass a method by [or get a pointer to a method] by NOT using ()’s
–ex:
a.my_method_name # pointer in Python
so…how to do this in Ruby?
answer: pass a proc object and then call .call(params) on it, or pass an instance and a symbol to call for its method name, i.e.
proc {|args| a.my_method_name(args) } # and then call .call on it
or
[a, :my_method_name] # and then call it via param_name[0].send(param_name[1], arg1, arg2, arg3)
I suppose you could abstract this to a new class that just does this for you, like instance.get_bound_method_name and then call it, but the way explained is one example.
I think Python calls these callables or “first class functions” or something along those lines.
Don’t actually know if this is an “efficient” microcredit firm, but here’s a link [paypal's partners].
https://www.microplace.com/
Powered by WordPress