function

New to C and C Structures -- How to take a struct as a parameter in a function.

New to StackOverflow and new to C. I'm trying to take a struct as a parameter in a function 'add_fields', which adds the first two int fields 'a' and 'b' and puts the result in int field 'c'. Not getting anything from the compiler, so obviously I'm doing something wrong. I just don't know what. Any help would be appreciated. #inclu...

Objective C - How to add a method to an existing class ?

How can i add a new method to NSString class. I need to create a method that get's called on a string and returns an NSDictionary. I know that i can simply create a function that gets a string and return an nsdictionary, but i want to know how to add it to an existing class. NSString *myStr = @"some json string"; NSDictionary *dictionar...

Perl function name clash

I'm in a situation where a module I'm using has a function that's name is exactly the same as one in my own module. When I try to call the function in my module (OO Perl, so $self->function) it's calling the function from the other module instead. I've already got around it by renaming my function but as a matter of interest, is there a...

jQuery("#myCarousel").jcarousel is not a function?

I am new to jQuery. I am trying to use the example "simple" jCarousel in my asp.net pages. I have a top.master page that contains the head content which contains the javascript to setup myCarousel. There are no spelling errors in myCarousel which is used in the setup section. Now when I use FireFox with firebug, as soon the script for s...

Android link to another package's function

I've got two android apps, one with a public void. How would the other app call this function? ...

Can we call a function inside a routine where the function return data type is void?

For example, I have: void(temperature, pressure,time) { int i; double results[10]; for (i = 0 ; i <= 9 ; i++) { fx(temperature, pressure, time); results[i]=fx[i]; } } (P/S: above is the simplified version of my real problem) fx by itself is of course another ste of codes with equations for calcul...

Compress this into a function?

Hi I have the following code which is really long of course, how can I compress this into a function? Then call this function with the other weekdays and lessons in the week? Currently Im just using the same code over and over just replacing the variables (which are strings). //Allocate and add objects to monday week one. monArrayA ...

Virtual function implemented in base class not being found by compiler

I've got a situation where it seems like the compiler isn't finding the base class definition/implementation of a virtual function with the same name as another member function. struct One {}; struct Two {}; struct Base { virtual void func( One & ); virtual void func( Two & ) = 0; }; struct Derived : public Base { virtual...

How to call a function dynamically

I have in vb a selector Dim ver =101 Select Case ver Case 101 upd101() Case 102 upd102() Case 103 upd103() End Select How can I make this select better by calling function in more dynamically in this form: with the prefix "upd" followed by a ver integer..? thank you! A...

How to Work with PostgreSQL Function Output in PHP

I have a postgresql (V 8.4) function that returns SETOF a custom type. An example of the string output from this function is the following 4 rows: (2,"CD,100"," ","2010-09-08 14:07:59",New,0,,,,,,"2010-09-06 16:51:51","2010-09-07 16:51:57",) (5,CD101,asdf,"2010-08-08 14:12:00",Suspended-Screen,1,10000,,,,,,,) (4,DNR100,asdf,"2010-09-08...

Comparing strings in PHP and removing one of them from the array if they are similar

Let say I have an array like this: Band of Horses - Is There a Ghost Band Of Horses - No One's Gonna Love You Band of Horses - The Funeral Band of Horses - The Funeral (lyrics in description) Band of Horses - Laredo Band Of Horses - Laredo on Letterman 5.20.10 Band of Horses - "The Great Salt Lake" Sub Pop Records Band Of Horses - "No ...

Mix Objection Notation and regular Style in Javascript Functions?

Hi, A small question for versed javascript programmers: There are two ways to declare a function in javascript. A: javascript-object-notation function MyLittleHouseA(name) { this.age = 88, this.name = name, this.getName = function() { return this.name; } } B: uhm, normal: function MyLittleHouseB(name) { ...

In Perl, how can I check from which module a given function was imported?

I have a code which calls the function. But I don't know the module this function belongs to. I need it to modify this function. How can I check it? ...

enable wpautop filter on single posts only

I've added the following to my wordpress themes functions.php file: //disable wpautop filter remove_filter ('the_content', 'wpautop'); remove_filter ('the_excerpt', 'wpautop'); Which strips out all those pesky <p> </p> tags wordpress wraps around everything! However, I was wondering if there was a way to do this ONLY on non-single pa...

Javascript: stringify object (including members of type function)

I'm looking for a solution to serialize (and unserialize) Javascript objects to a string across browsers, including members of the object that happen to be functions. A typical object will look like this: { color: 'red', doSomething: function (arg) { alert('Do someting called with ' + arg); } } doSomething() will only...

How to convert a javascript string to a javascript function, preserving the correct "this"?

A browser element has an onpopupshowing attribute, which is a string consisting of several javascript statements. I want to "override" that bit of javascript. Were this a function, I'd just assign it to a variable, assign my "overriding" function to the element attribute, and (if need be) call the original function from my overriding o...

How can I assign a default value to a structure in a C++ function?

I have a structure: typedef struct { double x,y,z; } XYZ; I want to define a function like this: double CalcDisparity(XYZ objposition, XYZ eyeposition, double InterOccularDistance = 65.0) But I can't seem to find a way to assign a default value to eyeposition. How can I do this in C++...

$(window).load() inside function

There are many dimensional functions, inside one of them we need to use onload event (do something when page is loaded). The problem is the code inside $(window).load(function(){}); doesn't work. But it works outside the function. Whats the problem? ...

JQuery - Custom function works once, then not recognized

So I got this code $(document).ready(function(){ $.fn.loadView = function(a){ }; $('#id').click(function(){ $.fn.loadView(); }); $.fn.loadView(); }); So when the code loads up the initialized $.fn.loadView() just fine the first time. But then when $('#id').click is activated I get this error $.fn.loadVi...

powershell retrieve function name

Is there a way to retrieve a function name from within a function. for example: function foo { [string]$functionName = commnandRetrievesFoo Write-Host "This function is called $functionName" } PS > This function is called foo ...