function

checkUnique function?

Hey, so I have created a function to check the DB for unique entries, but when I call the function it doesn't seem to work and gives me a fatal error any ideas from the function or do you wish to see the sign up page calling it. Thanks :) //Check for unique entries function checkUnique($table, $field, $compared) { ...

Fatal error on a non-object

Hey, so I have created a function to check the DB for unique entries, but when I call the function it doesn't seem to work and gives me a fatal error any ideas ? Thanks :) //Check for unique entries function checkUnique($table, $field, $compared) { $query = $mysqli->query('SELECT '.$mysqli->real_escape_string($f...

online graphs of common tween / easing functions?

Is there an online cheat-sheet to graphs of common tween / easing functions? I want a bookmark I can refer to when picking a function for a tween (e.g., Quintic, Quadratic, "Bounce"). The only one I can do in my head easily is linear. ...

Compatibility issues with <a> and calling a function(); across different web browsers

Hi, I am new to javascript. I wrote the following function rollDice() to produce 5 random numbers and display them. I use an anchor with click event to call the function. Problem is, in Chrome it won't display, works fine in IE, in firefox the 5 values display and then the original page w/anchor appears! I am suspicious that my script ta...

Usefulness of Toggle functions

Is it better to write functions that explicitly do something (i.e. HideForm/ShowForm etc...) or is it better to write 'Toggle' type functions (i.e. ToggleVisibility)? I find Toggle type functions awkard because it's hard to track the state by reading the code. In what situations is a toggle type function useful? ...

Is it possible to check whether a function is a javascript function or a developer defined function?

Given a function, I'd like to know whether it's a developer-defined function or a built-in function provided by JavaScript engine. Is it possible? For a developer-defined function, I'd like to trace its execution. ...

Call a void* as a function without declaring a function pointer

I've searched but couldn't find any results (my terminology may be off) so forgive me if this has been asked before. I was wondering if there is an easy way to call a void* as a function in C without first declaring a function pointer and then assigning the function pointer the address; ie. assuming the function to be called is type vo...

What does RETURN TRUE do in a php function?

I was just looking at this code and i don't understand what RETURN TRUE does or what the point of it is? Can someone please explain? class Elephpant { public $colour; public function dance() { echo "elephpant dances!\n"; return true; } } Thankyou in advance ;-) ...

How to make a php function contain mysql commands

I want to create a simple menu function which can call it example get_menu() Here is my current code. <?php $select = 'SELECT * FROM pages'; $query = $db->rq($select); while ($page = $db->fetch($query)) { $id = $page['id']; $title = $page['title']; ?> <a href="page.php?id=<?php echo $id; ?>" title="<?php echo $title; ?>"><?php echo ...

Need a function in javascript to swap 2 elements in an array

A program to swap two numbers /* /* Function to swap two numbers. Function takes an argument which is an array of two elements. Function returns a new array containing the same two elements as the argument array but in reverse ord...

[C++] Trouble declaring and recognizing global functions

I've created some mathematical functions that will be used in main() and by member functions in multiple host classes. I was thinking it would be easiest to make these math functions global in scope, but I'm not sure how to do this. I've currently put all the functions in a file called Rdraws.cpp, with the prototypes in Rdraws.h. Even w...

look for evaluation function in tictactoe 3d game

I'm trying to apply minimax algorithm for the game tictactoe 3D in c++. I'm struggling to find a good evaluation function for it. Does anybody know where has good resource to find the evaluation function? Thank you. ...

int foo(type& bar); is a bad practice?

Well, here we are. Yet another proposed practice that my C++ book has an opinion on. It says "a returning-value(non-void) function should not take reference types as a parameter." So basically if you were to implement a function like this: int read_file(int& into){ ... } and used the integer return value as some sort of error indic...

Find out if function has any output with php

Quick one for you guys. Say I have a function that outputs a string: function myString() { echo 'Hello World'; } How would I go about testing to see if the function outputs any data? if(myString() ==''){ echo ''Empty function; } ...

Find redundant user functions

I'm profiling an app that has a boat load of functions in many files and I'm trying to isolate functions that don't get called ever. Any ideas before I proceed? ...

how to echo data that we read with file_get_contents

i want to check remote url's page contents. IF remote site's page content contains string http://yahoo.com set $qqq = YH if not contains $qqq = NOYH. i am not talking about "url of that page" im talking about page content of url $url = "'".$get['url']."'"; $needle = "http://yahoo.com/"; $contents = file_get_contents($url); if(stripos($c...

Redefining PHP function?

If I have a function: function this($a){ return $a; } If I wanted to redefine the function, would it be as simple as rewriting it? function this($a, $b){ //New this function return $a * $b; } ...

Return variable in function from method callback data in same function

How do I return the latlon variable for codeAddress function. return latlon doesn't work, probably because of scope but I am unsure how to make it work. function codeAddress(addr) { if (geocoder) { geocoder.geocode({ 'address': addr}, function(results, status) { if (status == google.maps.Geocoder...

Using parameterized function calls in SELECT statements. SQL Server

I have taken over some code from a previous developer and have come across this SQL statement that calls several SQL functions. As you can see, the function calls in the select statement pass a parameter to the function. How does the SQL statement know what value to replace the variable with? For the below sample, how does the query en...

sql server 2000: current_timestamp as function actual param

how can i use the "current_timestamp" as actual param of a function, perhaps in a view that contains the function? the db is a sql serve 2000 ...