function

When developing an R package, do I have to recompile the package every time I make a change?

I am developing a package in R When I am debugging a particular function or set of functions, what is the best way to test the function? Do I have to either use source('function.R') or R CMD build each time I want to check my changes? (extra credit for associated emacs ess key-bindings) ...

JQuery: how to write a plugin function that will take a function name as string and run it?

I am facing a challenge and don't know how to solve this in jQuery. My purpose is to write an extended function replacing the Facebook callSWF function. Facebook callSWF run like that: **domObj.callSWF("myFunctionName", param1, param2 ... paramx);** Now, I need to replace that function. For jQuery, I can call the Flash via JS like ...

Smooth Custom AS3 Movieclip repel function

I wrote this repel function (below) for 2 movieclips and I call it from a timer instead of an enter_frame listener (speed), but it has the tendency to jerk and not be very smooth. How can I smooth the movements? I was thinking maybe adding some sort of padding or something, but idk...Any help would be greatly appreciated. Thanx :) func...

jQuery preventing functions with stopPropagation

I have an input field in a form. On 'keyup' I display a suggestion list (like many search boxes). The results in the suggestionbox are clickable. Now I want to hide the suggestion list when I click anywhere but the list, but the single suggestions still have to be responsive. In another thread/question I read the answer to use stopPro...

Calling primitive operator-functions explicitly in C++

int a, b, c; //do stuff. For e.g., cin >> b >> c; c = a + b; //works c = operator+(a,b); //fails to compile, 'operator+' not defined. This on the other hand works - class Foo { int x; public: Foo(int x):x(x) {} Foo friend operator+(const Foo& f, const Foo& g) { return Foo(f.x + g.x); } }; Foo l(5), m(1...

Determining BigO of a recurrence

T (1) = c T (n) = T (n/2) + dn How would I determine BigO of this quickly? ...

Help extending a function.

Hello Everyone, I found a function which will extract a word that is between 2 other words and this works well but I would like to extend the function so it scan the entire string that I choose and extract ALL of the words that are between the 2 keywords and not just the first one it comes to. I am guessing I will need to add a loop of ...

JavaScript: Call init function vs. returning that function call

Didn't think carefully about this post before submitting. Apologies. ...

function remove doesn't work, please help

Hi, If someone here is willing to help me I would really appreciate the function removeInput() of javascript at below not work properly, what i should do? <script language="javascript"> fields = 0; function addInput() { if (fields != 10) { var htmlText = "<input type='text' name='friends[]' value='' size='auto' maxlength='...

Greasemonkey, overriding website functions

i've been reading a lot and have been trying to get this done for about 5 hours now... so here it is I want to write a script that will override a function dummy() {$.ajax(...)}; on a website. here is how i'm trying to do it unsafeWindow.dummy = function(data){differantFunction(); $.ajax(...);}; function differantFunction(){ ... } ...

JS: Using variable names to call function.

Im working with jQuery. I have an app that makes ajax requests to server that responds with JSON. in some cases the response from the server will indicate the name of a JS function to be called {"responseType":"callback", "callback":"STUFF.TestCallback","callbackData":"this is in the callback"} If the responseType is "callback" as a...

scramble function won't output

this function will not give me an output when tested in python's IDLE: import random def scramble(string): rlist = [] while len(rlist) < len(string): n = random.randint(0, len(string) - 1) if rlist.count(string[n]) < string.count(string[n]): rlist += string[n] rstring = str(rlist) return ...

Calling a php function from a preg_replace causes the function to load at the top of the page

We have some bbcode and I'm trying to setup the ability for a certain code to call a function that loads some images from our photo gallery. So if someone puts in an album number, it pulls 5 of the most recent photos out. When we call this function regularly (on another page, just as a regular php statement), it works as expected. But wh...