Displaying 20 results from an estimated 43 matches for "do_stuff".
2006 Oct 19
1
Question about variable assignments/scoping after render call
I''ve got a question about how variables are made available to templates. We
have a test that looks something like this:
def test_variable_assigned
xhr :get, :do_stuff, :id => 1
assert_not_nil assigns(:thing)
end
And our app code looks like this:
class SuperClass < ActionController
def do_stuff
@parent_model = ParentModel.find(params[:id])
render :template => ''superclass/do_stuff''
end
end
class SubClass < SuperC...
2006 Apr 10
3
form_remote_tag : additional onsubmit funct. possible ?
...r
hidden as soon as the button is pressed to avoid having it possibly get
pressed again ( sometimes the rails response is slow enough for a user
to think they need to re-press it ).
example:
<div id="form_container">
<%= form_remote_tag :url => { :action => ''do_stuff'', :id => @stuff.id }
%>
<%= hidden_field_tag "info", @info %>
<%= text_field_tag "input_here", "0", :size => ''5'' %>
<input type="submit" value="DO_STUFF">
</form>
</div>
---
How...
2006 Apr 07
6
Multiple view types for a single action?
Is it possible to have more than one kind of view for a specific action,
for example an .rhtml and a .rjs file to handle the view for the same
action?
I suspect not, but this makes me wonder if there a way to call the .rjs
file from within the .rhtml so the statements within it get executed?
Thanks,
Andy
2017 Jun 15
2
Function Inlining and undef / poison question
...emails got me thinking about inlining.
>>
>> I say this function is always well defined,
>> And it always executes statement S
>>
>> F(a)
>> {
>> If (a == a) S;
>> }
>>
>
I think the problem can be seen as:
void F(int a)
{
if (a == a) do_stuff();
}
....
main()
{
int x;
F(x);
}
If the compiler doesn't inline F, it will definitely call F, where the
compiler doesn't KNOW that x is undef, and as a result, do_stuff is
guaranteed to execute. If F is inlned, x is known as undef, so the compiler
decides that the comparison is f...
2006 Jun 05
5
Controller-wide instance variable
Is it possible to declare an instance variable in a controller that is
available to every action without defining the variable in every action?
--
Posted via http://www.ruby-forum.com/.
2006 Aug 01
2
Partial Naming Madness
...well. Each foo partial makes use of a variable inside called ''foo'' (and
can get foo.id etc).
After all the partials are loaded, I need to :update a div corresponding
to one of the partials (ie re-load the partial in that div). I do this
via a link_to_remote call, calling the do_stuff method in a controller.
The do_stuff method attempts to render the foo partial back, passing it
a variable like so:
render_partial ''something/foo'', nil, ''foo'' => Foo.find(params[:foo])
This code complains that foo is null when it renders back, however, if...
2008 Jul 17
2
[LLVMdev] Casting between address spaces and address space semantics
...(address_space(2))) char mem2[100];
Now, we are using a function which reads a value from one of these memories
and does some processing. Since we want to execute this function for multiple
memories, we make it accept a pointer in the generic address space (ie, no
address space attribute):
void do_stuff(char* mem);
Somewhere later on, we call the function as follows:
do_stuff(mem1);
...
do_stuff(mem2);
As expected, the LLVM IR resulting from this contains a bitcast to remove the
address space from mem1 and mem2 (and also cast from [100 x i8] to i8*, but
that is less interesting). Now, this b...
2005 Apr 23
7
Validation question
Hi all,
Is there a way to invoke validations at times other than save, create
and update? I know that I can do this by writing my own validation
checks using errors.add_[blah], but I''d like to leverage the existing
validation code.
What I have is two sets of fields in a record, set A and set B. Both
sets must be validated on record create. However, the trouble is that
after
2008 Jun 05
4
[LLVMdev] Adding DenseMap::FindAndConstruct with a default value
Hi All,
I've been fiddling around with a DenseMap to store cached copies of some
result. In short, I'm doing the following:
It = Map.find(Key)
if (It != Map.end() && It->second != Unknown)
Return It->second;
// do_stuff
return Map[Key] = Result;
However, I this requires two lookups in the hash table, which is not so nice.
Currently, there is no way to write this down so you only do one lookup.
Intuitively, you'd write:
ValueT &Value = Map[Key];
if (Value != Unknown)
return Value;
// do_stuff
return V...
2007 Dec 18
16
shared behav
hi, i want to make a behavior shared between models, the examples
need to create new instances etc. Is there a way to pass the model
class to the shared behavior?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071218/5b400cc5/attachment-0001.html
2008 Jun 04
2
Handling exceptions
...as an edge case that won''t happen every time
the worker is invoked.
As of now, I''ve just added some basic exception handling to log the error
for future inspection like so:
class EmailWorker < BackgrounDRb::MetaWorker
set_worker_name :email_worker
def run(data = nil)
do_stuff
rescue Exception => ex
logger.info ex
end
end
Is this generally the practice for doing exception handling within workers
or is there another approach?
Regards,
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/back...
2011 Sep 07
4
jquery and ajax query in rails 3
hi people
I don''t know much about ajax - jquery. And right now I need to use
some functionality with them.
In a form (sales model) I have the following code:
<div>
<%= f.label :product_id, "Product" %>
<%= f.collection_select( :product_id, Product.all, :id, :name,
options={} ) %>
</div>
<div>
<%= f.label :price,
2007 Sep 05
2
after_create callback called twice in test env when using fixtures
...ly happening a) in the test environment, and
b) when there is a fixture file for that table.
The test below only prints "Doing stuff" one time if I remove the
''fixtures'' line. Likewise, saving the item through ./script/console
in development mode also does not call the do_stuff method twice.
I''m inclined to think that this is a bug in the handling of fixtures,
but I''d love to be proven wrong. I couldn''t find this in trac, but if
there''s an open ticket, then I''d like to know about it. If not, and
if everyone agrees that this...
2006 Jan 23
3
HABTM: Records with no parents
I have a habtm relationship between two models. What I want to do is
find items that aren''t related. So like if you had authors <->
posts, how would you find authors who don''t have any posts? Or posts
that don''t have an author ?
Thanks,
Alex Strand
[astrand@razorcom.com]
Razorcom
www.razorcom.com
2013 May 15
4
hiera - anything better than empty string?
...o exclude it
for 10.9.8.7.
Is there a ''special'' hiera value I can set in 10.9.8.7.json to stop the
search falling down into default.json ?
At the minute we''ve set an empty string, but then templates etc. need to be
littered with
if ($url_from_hiera != "") {
do_stuff()
}
which feels like the sort of ''magic variable'' that will bite future me in
the ass in around 6 months.
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from i...
2017 Jun 15
2
Function Inlining and undef / poison question
Nuno,
One of your recent emails got me thinking about inlining.
I say this function is always well defined,
And it always executes statement S
F(a)
{
If (a == a) S;
}
And that if this function is inlined it must still be well defined,
And still always execute statement S
But if I read your example correctly you feel that the result
of inlining is undefined behavior because “if
2009 Jul 20
2
[LLVMdev] x86 unwind support[MESSAGE NOT SCANNED]
...n, this would be a useful thing.
in llvm from svn an "unwind" instruction is mapped to a call to
_Unwind_Resume. This is no good for throwing a new dwarf exception,
but it does mean that you can now implement cleanups as:
invoke XYZ to label %normal unwind label %cleanup
cleanup:
do_stuff
unwind
Ciao,
Duncan.
2007 Mar 05
0
dynamic status back to client...
Hi,
I have a long worker process I want to capture the output as dynamically
as possible and send it to the client. I do the following currently:
class SvnWorker < Worker::Base
def do_stuff(args)
tmp = []
my_project = args[:repo]
# Import the contents of a 20 Meg project into a bare bones svn repo.
import_status = `svn import #{path_to_extracted_zipdir}
file://#{my_project}`
tmp = import_status
results[:response] = tmp
end
def status
results[:response]
end
end
This o...
2007 Mar 05
1
How to add a custom function to return something to file => content
I''m having a heck of a time with this.
Basically I want to write a custom function that returns a value to the file
content type.
Ex: file { /blah: content => do_stuff(option) }
I looked at the wiki posting but just haven''t been able to figure out how to
make this work.
The first error that I get when I try to actually use ''return'' is:
"return can''t jump across threads"
Ok, so I take away the return and get
"...
2010 Jun 02
0
Multiple threads writing to the same Starling queue doesn't work?
...the "same time"?
It doesn''t seem reliable according to my tests - but maybe I am doing
something wrong.
If I do:
def test_starling
FooWorker.asynch_foo_test(:my_id => ''foo'')
temp = []
for i in 1..1000
temp << Thread.new(i) {|random_value| do_stuff(random_value)}
end
temp.each do |t|
t.join
end
end
def do_stuff(lvalue)
starling = Starling.new(''localhost:22122'')
starling.set(''foo'', :rvalue => lvalue)
end
# In FooWorker:
def foo_test(options)
starling = Starling.new(''localhost:...