function

Jump to function definition in vim

How can i jump to to a function definition using VIM? For example with Visual Assist i can type ALT+g under a function and it opens a context menu listing the files with definitions. How can i do something like this in vim? ...

How can I call a static method on a variable class?

Hi, I'm trying to make some kind of function that loads and instantiates a class from a given variable. Something like this: <?php function loadClass($class) { $sClassPath = SYSPATH."/classes/{$class}.php"; if (file_exists($sClassPath)) { require_once($sClassPath); $class = $class::getInstance(); } } ?> If I use it like...

Passing a list of numbers to a function in C++ without building array first?

I'm trying to build a function that accepts an array in the following manner: int inCommon = findCommon({54,56,2,10}, 4); int findCommon(int nums[], int len){ for(int i=0; i<len; i++) cout<<nums[i]<<endl; return 1; } Note, that's not actually what my function does, but I do loop through the array. I'm just trying to determine if...

C++ Pointers to Member Functions Inheritance

I have a need to be able to have a super class execute callbacks defined by a class that inherits from it. I am relatively new to C++ and from what I can tell it looks like the subject of member-function-pointers is a very murky area. I have seen answers to questions and random blog posts that discuss all sorts of things, but I am not s...

Delphi Pascal Problem when WMDeviceChange function calls other functions/procedures.

SOLVED I am using delphi 2009. My program listens for usb drives being connected and remove. Ive used a very similar code in 10 apps over the past year. It has always worked perfectly. When i migrated i had to give up using thddinfo to get the drive model. This has been replaced by using WMI. The WMI query requires the physical di...

Static variables in an anonymous function

Hi, I'm trying to mimic static variables on a JavaScript function, with the following purpose: $.fn.collapsible = function() { triggers = $(this).children('.collapse-trigger'); jQuery.each(triggers, function() { $(this).click(function() { collapse = $(this).parent().find('.collapse'); }) }) } How do I save the "co...

Javascript callback function issue.

Background I'm writing an asynchronous comment system for my website, after reading plenty of tutorials on how to accomplish this I started building one from scratch. The comments are pulled using a JSON request and displayed using Javascript (jQuery). When the user adds a new comment it goes through the hoops and finally is sent via ...

How to use a bitwise operator to pass multiple Integer values into a function for Java?

In application frameworks I keep seeing frameworks that allow you to pass in multiple Int values (generally used in place of an enum) into a function. For example: public class Example { public class Values { public static final int ONE = 0x7f020000; public static final int TWO = 0x7f020001; public sta...

In VB.NET, can I mark a function as deprecated?

Hi, Is there an ability in VB.NET to deprecate code? I know that in C# there are 'attributes', and tags in java; is there anything similar in VB.NET, other than leaving a 'todo:...? ...

Can I use execvp() on a function defined inside my program?

I have a C++ function that I'd like to call using execvp(), due to the way my program is organized. Is this possible? ...

Read variable from another function

How can I access an variable from another function? I have a function that sets and variable: private function create () { var str:String = "hello"; } private function take() { var message:String = str; } ...

Need Help With Arrays,Functions and Binary Search (Java)

So basically what I want to do is a program that asks the user how big he wants his array to be and for the user to introduce the values inside the array. Then I want the user to be able to introduce a number and for the program to determine in which array the number is or determine that it doesn't exist. The following program currently ...

Can I use jQuery to create a function that on click goes to a URL then executes a jQuery function on it?

Hello. I am not entirely sure if this is possible or not but so far you guys here at SO were always able to help me out so here it goes: The following website: www.bgarchitect.co.nz Has a navigation that works fine on the main page but (due to me making a mistake) does not work on the sub pages as it relies on images being loaded and ...

How to remove html special chars in PHP?

I am creating a rss feed file for my application in which I want to remove HTML tags, which is done by strip_tags But strip_tags is not removing html special code chars &nbsp; &amp; &copy; etc Please tell me any function using which I can remove these special code chars from my string, Thanks ...

Error in returning a pointer from a function that points to an array

Greetings Everyone, I'm in a bit of a fiddle in that I dont know why my code brings up the following error when compiling: 1>..\SA.cpp(81) : error C2664: 'CFE' : cannot convert parameter 1 from 'int' to 'int []' 1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Esse...

What's the advantage of this indirect function call?

I found the following code in a library: class Bar { public: bool foo(int i) { return foo_(i); } private: virtual bool foo_(int i) = 0; }; Now I'm wondering: Why would you use this indirection? Could there be any reasons why the above would be better than the simple alternative: class Bar { public: virtual bool foo(int i) ...

Calling remote php functions from an iPhone app

Anyone have any suggestions on how to set up both the php and the cocoa side of calling php functions? As a quick idea of what I want to do, I want to be able to to populate two tables with data and add/remove data from the db. So I want to set up a few functions in php that I can call from my iPhone code that will return values from my ...

How to tell compiler to NOT optimize certain code away?

Is there a way to tell the compiler (g++ in my case) to not optimize certain code away, even if that code is not reachable? I just want those symbols in the object file. Example: Here is a simple function, and I do want this function to be compiled, even if it's never called. void foo(){ Foo<int> v; } If there is no official compil...

Common Lisp: The Remove Function, how is it used?

I have a query request-uri in the form of "/node/143" (just an example of the format). I want to strip the first forward slash from the string, I looked up the function remove and had a try. I just can't seem to get it working (I'm using SBCL on Linux). I've set the request-uri using this code. (setq request-uri "/node/143") When I ...

C++ functions: ampersand vs asterisk

Let's say you have a function that modifies a variable. Should you write it like this: void myfunc(int *a) or like this void myfunc(int &a)? The former forces you to call the function with myfunc(&b) so the caller is aware that b will be modified, but the latter is shorter and can be called simply with myfunc(b). So which is better to ...