|
Hi,
If I add an after_save callback to an ActiveRecord model, and on that callback I use update_attribute to change the object, the callback is called again, and so a 'stack overflow' occurs (hehe, couldn't resist).
Is it possible to avoid this behavior...
Started by Ivan on
, 11 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
Class Foo << ActiveRecord::Base the callback runs def....
I solved it by using conditional invocation for the callback ...
Could you use the before_save callback instead?
If you use before_save, you can modify any additional.
|
|
I have some code like this (this is a simplified example):
function callback_func($matches) { return $matches[0] . "some other stuff"; } function other_func($text) { $out = "<li>"; preg_replace_callback("/_[a-zA-Z]*/","callback_func",$desc); $out...
Started by Paul Wicks on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Preg_replace_callback does not modify the string in place, but instead returns a modified .= preg_replace_callback("/_[a-zA-....
"some other stuff";
Then it will add with it.
In callback_func() you have to use:
$out .= $matches[0] .
|
|
For example,
http://www.php.net/manual/en/function.preg-replace-callback.php
<?php // this text was used in 2002 // we want to get this up to date for 2003 $text = "April fools day is 04/01/2002\n"; $text.= "Last christmas was 12/24/2001\n"; // the...
Started by bobo on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
I don't know if it's the easiest solution, but I'd go for a object-method callback, where the object carries the required parameters in its state:
class Callback { public $parameter; public function Callback(); $instance->parameter....
|
Ask your Facebook Friends
|
$("select[name=field[]]").live("change", function() { $.getJSON("/json.php",{id: $(this).val(), ajax: 'true'}, function(j){ options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay...
Started by Harris on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Why not place the $(this).siblings("[name=logic[]]").html(options); line within the callback itself.
|
|
Last week we had an agent who saw the LIVE callback link blinking but when clicking it, it would show an empty callbacks page. After using the 'remove callbacks older then 7 days' link the problem would be solved.
Now we have another agent with the same...
Started by dspaan on
, 15 posts
by 2 people.
Answer Snippets (Read the full thread at net):
];
var CB_status = call_array[6];
var CB_lastcall_time = call_array[7];
var CB_callback_time=\"log_text\">" + CB_callback_time + "</td><td align=\"right\"><font class=\"log=\"log_text\"><a href=\"#\" onclick=\"....
|
|
Hi there,
our agents are praying me for this little feature.
When they select Personal CallBack as Disposition, they write down a lot (2-3 rows) of comments.
Then happens this: when they recall that lead, from that time on, they lost the comment. It would...
Started by DarknessBBB on
, 17 posts
by 6 people.
Answer Snippets (Read the full thread at net):
But not for the status, just the callback on this in SVN last week....
To store the callback notes and keep the callback state even after you get no answer or answer device i think they actually had activity on this in SVN last week.
|
|
Q1. Why are callback functions used?
Q2. Are callbacks evil? Fun for those who know, for others a nightmare.
Q3. Any alternative to callback?
Started by Devil Jin on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
When taken some....
Now it's SQLite's business to execute callback.
It executes the query and invokes the callback for each row as it is retrieved.
You give it a query and optionally a callback.
For example look at sqlite3_exec().
|
|
In c++, when and how to use a callback function?
EDIT: I would like to see a simple example to write a callback function.
Started by Dave17 on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Callback mechanisms are often implemented via function pointers, functor objects....
A Callback function is a method that is passed into a routine, and called at some point?
There isn't an explicit concept of a callback function in C++.
|
|
I asked a question about callbacks and arrived at another question (see comment). How is a closure different from a callback?
Started by leeand00 on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Different....
See example 4.
The bit that makes it a closure them).
A callback/javatutors/closures2.shtml
Basically, the callback is like a function pointer.
In practice, that means it's a function that has some hidden variables .
The expression).
|
|
Update: The code below does indeed work as expected, and accomplishes the code I wanted. My confusion was in understanding what I had in my markup when writing the code below - after giving my markup a second look, I realized my code worked perfectly....
Started by Jonathan Sampson on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
That way for each box of div's you will run two... .
Try this, I understand what's wrong here, apologies for not getting it immediately
$("div.module-body").each(function(){ $("div.module-body", this).css("height", maxHeight); });
After the first each block .
|