function

Is there a specific name for this normalization function?

I want to write a normalization function that will take a signed integer and normalize it to a double between -1 to +1. Is there a special name for this type of function, or is Normalize() what people normally call it? Also, is there a native iPhone function that does this? ...

Why do functions in some popular languages return only a single result?

Why do functions in some popular languages return only a single result? ...

MySql function not using indexes

Hi. I have simple function consist of one sql query CREATE FUNCTION `GetProductIDFunc`( in_title char (14) ) RETURNS bigint(20) BEGIN declare out_id bigint; select id into out_id from products where title = in_title limit 1; RETURN out_id; END Execution time of this function takes 5 seconds select Benchmark(500...

Find the function calling the function in JS?

What's the best way to find the function that's calling the function? For example, if I have function first(){ doSomething(); } // Lots of code function doSomething(){ alert('Somehow, I know that' + ________ + 'function called me...'); alert('Boink, hit an error, but now you know what function called me'); } Is there any way ...

Javascript, Fire Function on click.

Hi, I'm new to javascript and I am attempting to create an element with certain html inside. This is my code: function newTask() { var newtask = document.CreateElement('li'); newtask.setAttribute('id','newtask'); newtask.innerHTML="DeveloperSnippets"; document.getElementById('newtaskcontainer').appen...

stored proc recursion in SQL Server

I have a situation where I want to have a stored proc returning a table that calls itself recursively as part of its calculation. Unfortunately SQL Server is having none of this and gives me an error along the lines of both being unable to declare a cursor that already exists and about not being able to nest and insert exec statement....

modify sql function, delete first character in string

Hi, I want to modify the following "extract numbers" function below to check if the first number in the output is "1", if so, delete the the "1" before displaying the output. THanks! Ex. Input: QW 1 RT 309 Output: 309 create function [dbo].[ExtractNumbers](@Numbers nvarchar(2000)) returns nvarchar(2000) as BEGIN declare @NonN...

Using an argument of a function in normal mode in Vim?

I have a Vimscript function defined like this: function Cs(a, b) normal a:a|"cylr a:b|x"cP endfunction However, the intended action (do some crazy stuff with the arguments a and b in normal mode) doesn't work, instead it takes the first "a" as "append" and writes the rest of the line to the file. How can I use arguments on a "no...

How easily create forms with php?

Ok, I am programming a website and I need to do a lot of html forms everywhere. How can I reduce amount of my time doing that? Any ideas? I guess it should be done with functions. I don't use neither any frameworks nor OOP yet. Thank you very much. ...

jquery .click pass parameters to user function

I am trying to call a function with parameters using jquery .click, but I can't get it to work. This is how I want it to work: $('.leadtoscore').click(add_event('shot')); which calls function add_event(event) { blah blah blah } It works if I don't use parameters, like this $('.leadtoscore').click(add_event); function add_event...

How do you make C# function parameters act as values?

Hello, My question is related to C# function parameters. I'm used to C++ where parameters are values by default unless you explicitly specify them as references. So, in C#, how do I make function parameters to be passed by value instead of by reference? Actually, I just want to know how to pass a variable, and not have that variable mod...

How to generate a net on a 8-dimensional sphere

Using Matlab, how to generate a net of 3^10 points that are evenly located (or distributed) on the 8-dimensional unit sphere? Thanks for any helpful answers! ...

How do you make classes in JavaScript?

How do you guys make "classes" in JavaScript!? I am using: function classFoo() { var classLevelVariable = 0; this.classFunction = function() { alert("The classFunction has been called."); classFunction2(); //Crash. classFunction2 is "undefined." } this.classFunction2 = function() { alert("classF...

jquery combine event functions

instead of example: $(".myfield").blur(function() { // validate }) $(".myfield").keyup(function() { // validate }) is there a way to combine these two? ...

Why exactly is onFreeze() used for?

In one Android Tutorial I saw the usage of this function. There he uses it for resuming the previous session of the application I think, but the problem is that I cannot ovveride this function in my class and both classes (mine & his) extend from ListActivity. @Override protected void onFreeze(Bundle outState) { super.onFree...

Rails Custom Functions EDIT: Update from inside the controller.

Right now I have this social media app, where I'm implementing ratings on users per category, What i want to do it's: Whenever an user casts a vote on an article, it will grab all the votes on the article and make an average of the score/votes and insert that value into another model that i have (User Category Rating), now my question i...

How to implement a "function" to be performed on an array in C#

Coming from a non-OO background in Matlab, I'm looking to perform some of the operations I am used to in a best-practice manner for C#. I have a class, which imports data from a source, and formats it into, amongst other things, an array of ints. I am going to want to perform some operations on this array. To keep it simple, lets say ...

Should functions be specific or generic

Possible Duplicate: Specific functions vs many Arguments vs context dependent So I've been developing for 3-4 years now, know a wide range of languages, know some impressive (to the small minded :P ) stuff. But something I've always wondered; when I make a function should it be for a specific purpose, or should it be moulded ...

Help need to merge two functions for jquery cycle?

I have two functions I would like to use in my before callback with jquery cycle. One slides the pager over as the user cycles through, and other other centers the image horizontally and vertically inside the containing div. Both work great separately, yet I can seem to get them to work together both on the before callback. I have an exa...

gettext works in one file and not the other?

Hi. I have a little trouble getting gettext to work. I made a simple test file where I call the translate.php and echo T_("XXXXX") and It get translated, but when I try to use echo T_ in a function it doesn't work.. translate.php: <?php error_reporting(E_ALL | E_STRICT); // define constants define('PROJECT_DIR', realpath('./fun...