function

Memory allocation to functions in C++

Hi All ! I am still a C++ newbie. Just came to read that the static member function of a class is not object specific - there is a single copy of the member functions for all the objects. Now two questions arise in my mind : What is the difference between an ordinary function and a static function "in terms of memory allocation only"...

About using an array of functions in Perl...

We are trying to build an API to support commit() and rollback() automatically, so that we don't have to bother with it anymore. By researching, we have found that using eval {} is the way to go. For eval {} to know what to do, I have thought of giving the API an array of functions, which it can execute with a foreach without the API ha...

Javascript function containing JQuery ajax - Function returns undefined

Hi, Can any give me a clue why this isn't working? The function returns undefined. It alerts a boolean values but still return undefined?! Thanks function IsUniqueEmail() { var email = $("#<%=EmailAddress.ClientID%>").val(); if (email.length > 0) { $.ajax({ url: 'handlers/validator.as...

MySQL stored procedure for duplicating records from 4 inter-related tables

I have 3 tables, networks, nodes, networknodes, networkconnections. networknodes has 3 fields network_node_id, network_id, and node_id, the last two are forien key references to network. and a network may include multiple copies of same node (but with diffrent network_node_id) networkconnections has the fileds networkconnection_id, sta...

Errors with MySQL stored function creation ERROR 1064 & 1327

I am using MySQL v5.1.36 and I am trying to create a stored function using this code. DELIMITER // CREATE FUNCTION `modx`.getSTID (x VARCHAR(255)) RETURNS INT DETERMINISTIC BEGIN DECLARE y INT; SELECT id INTO y FROM `modx`.coverage_state WHERE `coverage_state`.name = x; RETURN y; END// When entered into the...

C# Compiler says function is not defined, when it is...

I just need another pair of eyes... I don't see anything wrong with the following. In fact, I swear I had something just like this not long ago, and it worked. In my Collections.dll: namespace Collections { public class CSuperAutoPool { public static CSuperAutoPool ActivateByType(Type typeToBeActivated, params object[] act...

JavaScript new keyword and objects scopes

Later today, I was scrolling through ejhon.com slides and I found out the following: Give this code function katana () { this.myvar = true; } katana (); console.info (myvar); Past the moment I compiled the code, I thought that myvar is attached to the katana function. Actually, it gets attached to the window objects, which pollutes t...

Regex to parse C/C++ functions declarations

I need to parse and split C and C++ functions into the main components (return type, function name/class and method, parameters, etc). I'm working from either headers or a list where the signatures take the form: public: void __thiscall myClass::method(int, class myOtherClass * ) I have the following regex, which works for most fu...

Wordpress: how to get first level of children from a category?

I want to know if has a function that return only the first level of subcategories children. Cat 1 Sub-1.1 Sub-1.2 Sub-1.2.1 Cat 2 Sub-2.1 Here I want only: Sub-1.1, Sub-1.2 and Sub-2.1 Cause using get_categories with child_of parameter brings me all children until the last node: get_categories('orderby=id&show_count...

What is a php5 classes approach to this?

Hi there, I am programming in an old fashion - still using functions and not classes. For example, something basic I do when creating a basic template for a site is put the header and footer in a function like so in a file called functions.php <?php //header function outline_start() { echo ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1...

Is it possible to modify a global var from inside a function (AS2)?

Hello, being my first time to post a question on a site this kind, I'll try my best to do it OK. I'm Using ActionScript 2.0 attempting to check the existance of a certain file, with this code (I found it browsing the net): var myPelican:Number = 0; var myVars = new LoadVars(); myVars.load("portfolio_img/("+pCounter+").jpg"); myVars....

PHP - How to share / pass variables across different methods in a PHP Class

I am trying to set a value from a method of a class and trying to get it in another method. The example code is as below. I think the below kind of set/get works in a Java class. Googled out but still could not find a relevant solution. Searched: http://www.google.co.in/search?hl=en&amp;client=firefox-a&amp;rls=org.mozilla%3Aen-US%3Aof...

How to make Wordpress function example for html header

How to create a simple Wordpress function in functions.php I want to make a function something like custom_header() and the code in the function is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attrib...

Should functions always return something (Javascript)

Should functions always return something? I often write very basic functions which are used as shorthand to do things that happen a lot such as: function formsAway() { $("#login_form, #booking_form").slideUp(); } Should this function exist - is there a better way, or is this fine? ...

Previous function, but for two (or more) rows previous

I'd like to get the value of a cell, two rows previous, is that possible? I know I can do the row previous, but I'd like two (or more) rows previous Previous({myTable.myColumn}) ...

PHP get variable from function

function first() { foreach($list as $item ) { ${'variable_' . $item->ID} = $item->title; // gives $varible_10 = 'some text'; (10 can be replaced with any number) } $ordinary_variable = 'something'; } How to get values of this function inside an another function? Like: function second() { foreach($list ...

php - find if an array contains an element

I have an array with just a list of ids, like so: $my_array = array( 12, 17, 99, 23 ); Now I know I could probably do something like: function in_array($haystack = array(), $needle = NULL) { foreach($haystack as $id) { if ($id == $needle) {return TRUE;} else {return FALSE;} } } but it seems like there's probably already...

mysql functions in PHP functions.

For example: <? function getTitle(){ $query="SELECT title FROM news WHERE author = 'admin' LIMIT 5"; $result = mysql_query($query, $mysql_connection); $data = mysql_fetch_array($result,MYSQL_ASSOC); return $data['title']; } ?> And every time I want to submit a MySql query I must always include config.php inside the fu...

Unknown return type for a C function.

I am writing a library for C, and one function can return either a string (char *), an integer or a double. Next to that, the length of the string is unknown. I really don't know how to deal with this problem. I thought about using pointers as arguments to the function but that is really messy. Can anyone give me a solution, and maybe s...

Split concatenated field into separate parts

Using SQL Server 2008, I am trying to do something similar to this post regarding splitting a concatenated field into separate parts for normalization purposes. The problem with the solutions in the linked post is that they only work for delimited values. The data I am attempting to split would be similar to: UserID -- ConcatField 1 -...