function

JQuery : How to call an inside plugin function with a <a href> generated by another function of this plugin?

Hello everyone, I'm making a little widget for my site using a search api I just made. Briefly, I want to retrieve last posts or top rated posts. I've got to tabs for that. By default, on loading, I'm on recent posts. If I click on Top posts, I'd like to call a function inside my plugin that modify a var that tell to my search API to r...

Jquery/Javascript: what does the " i " in " (function(i){ " do/mean? How does it know that?

In the example below, the Jquery code changes the src of the images on the page to start with "test", and end with ".jpg", but what tells it what i is? if i'm correct, i could also be number, or e, or z, or n, or whatever word or letter i want, so, by placing that i in there, is it saying that i is the current object? or the name of the ...

PHP - Search for variable in array()

If I had this code: $result = 1; $square = array( "00" => -1, "0" => 0, "1" => 1, ); And wanted to know whether $result is equal to ANY of the array VALUES of $square (-1, 0 or 1). I´m am guessing there should be a function that compares a variable to all the array´s values and returs TRUE or FALSE accordingly. If there isn´t suc...

LISP function to remove nils

I want to write a function in LISP that will completely remove all NILS in a list. The list may be nested, meaning it can contain other lists inside. For example the list '((state L L L L) NIL (state L L R L) NIL) should be tranformed into '((STATE L L L L) (STATE L L R L)). ...

array of objects,c++

i have two classes namely Flight and Runway. Now i am trying to pass an array of these objects as parameter to a function. void fun(Flight ptr1[],Runway ptr2[]) { ... ... } ptr1 should point to an array of Flight objects and ptr2 should point to an array of Runway objects. Now inside this function fun() how do i access members of the...

What is the difference between declaring javascript objects with var vs. with function?

I'm a confused newbie. I read in a tutorial that you create a javascript object like so: function myObject() { this.myProperty = "a string"; this.myMethod = function () { //Method code } } Then I read somewhere else that you create an object like so: var myObject = { myProperty: "a string", myMethod : fun...

Update data frame via function doesn't work...

Hello, I ran into a little problem using R… In the following data frame test <- data.frame(v1=c(rep(1,3),rep(2,3)),v2=0) I want to change values for v2 in the rows where v1 is 1. test[test$v1==1,"v2"] <- 10 works just fine. test v1 v2 1 1 10 2 1 10 3 1 10 4 2 0 5 2 0 6 2 0 However, I need to do that in a function. ...

Array merge in ASP classic

I'm working on an array_merge function for ASP classic. What I have seems to be working, until one (or both) params are empty or not arrays. Here's what I have so far: function array_merge(left, right) dim total_size dim i dim merged ' Convert "left" to an array if not isArray(left) then left = Array(left) end if ' C...

How do I collect the keys of all true values in an array?

This is slightly modified version of the code in the PHP docs: http://php.net/manual/en/function.next.php <?php $array = array( -1 => true, 0 => false, 1 => true ); while ($bet = current($array)) { if ($bet == true) { echo key($array) . '<br />'; } next($array); } ?> This is as close as I could get t...

how to call an operator as function in C++

Hello, I want to call a specific operator of specific base class of some class. For simple functions it's easy: I just write SpecificBaseClass::function( args );. How should I implement the same for operators without casting trickery? Isolated problem: class A { public: A operator+( const A &other ) const {...} }; class B :...

I'm trying to write a function for postgresql to do some string manipulation...

The purpose of the function is to take a string and, if it contains parens, delete everything in the parens. Here's what I have: CREATE FUNCTION clearmethodparams(IN qname text) RETURNS text AS $BODY$ IF position($o$($o$ in qname) = 0 THEN return qname; ELSE return substring(qname from 0 for position($p$($p$ in qn...

Firebug constructor function vs user function

I have made a quick search about what is the mean of Firebug DOM tab coloring and I've got that: Red colored bold text points "constructor function" Green colored bold text points "user function". here is the reference link What is the difference between the two type of functions. For example: I have a page that included jQuery.js, ...

MySql : Break string by delimiters (^A)

I have a string that is of the: type 'field1^Afield2^Afield3^A' I need to break this string and get one of the fields. All the string functions I see in MySql that help you break by delimiter expect a string as the delimiter , example: SUBSTRING_INDEX("Hello. Break this. for me", ".", 1) would give = "Hello" How do i break mu string...

rails: data being deleted on page reload

I have a method in my application helper that is meant to deactivate a task in my database. Application helper: def link_to_destroy_task(task_id) Task.find(task_id).deactivate end Model: def self.deactivate() update_attribute(:active, false) end View: <ol id="tasks"> <% @Tasks.each do |task| %> <%content_tag_for...

calling the function, which is stored in a string variable.

it may be a duplicate of http://stackoverflow.com/questions/1120228/how-to-dynamically-call-a-class-method-in-net and of http://stackoverflow.com/questions/3918431/how-to-achieve-calling-a-function-dynamically-thats-right-the-function-to-be-cal but the above two have solutions which as the answers said are complicated, not for a be...

Convert callback function from C++ to VB.Net

I'm trying to convert C++ API to VB.Net, but this function is too hard and i don't know how make it work. Here is the API doc for this function: void RemoteDllSetReceiver(void *inst, on_received_buffer_t received_buf_cb); Sets a callback function to receive notifications from the DLL. The prototype of the callback is: typedef bool...

auto execute a function at the end of functions in PHP

Hi, i'm looking to call a custom error log/debug function at the end of each function. example: i want to call error_log(__METHOD__); I want to echo $query; show execution time etc.. at the end of every function for debug purposes without having to call that customized function every time. much appreciated. ...

Calling function from Powershell Cmdlet

I'm trying to create a cmdlet that calls Powershell function. Can this be done? Idea is to have static cmdlet that enumerates a set of data and then calls defined function to do something for each item. I can always copy - paste a base template for the enumaration part, but it really easy to make errors while making modification to para...

Getting the last item in a $('div').each()

I am using jquery and the each function but I am having trouble finding the last item in a ul list. DATA: <ul id="1"> <li>1</li> <li>2</li> <li>3</li> </ul> <ul id="2"> <li>1</li> <li>2</li> <li>3</li> </ul> <ul id="3"> <li>1</li> <li>2</li> <li>3</li> </ul> I have tried multiple things bu...

Pointers to objects in function scope

When you create some pointers inside the scope of a function, what happens when the function goes out of scope? Do they get destroyed or should I call delete on them at some point? void XMLDocument::AddNode(XMLNode& node) { std::string val = node.GetNodeName(); TiXmlElement* el = new TiXmlElement(val.c_str()); // What about th...