function

Is there such a thing as a catch-all key for a javascript object?

Considering the following javascript example: var myobj = { func1: function() { alert(name in this) }, func2: function() { alert(name in this) }, func3: function() { alert(name in this) } } myobj.func2(); // returns true myobj.func4(); // undefined function Is it possible to create a 'catch-all' key ...

php & mySQL: Load only functions that are needed and only on demand while avoiding duplication

Hi all, I use the following procedure to call the functions within the pages of my web app. //index.php include("functions.php"); include("file1.php"); include("file2.php"); I have all my functions going into functions.php page. The content of this page may be over 5000+ lines of code and it contains all the functions used within the...

Javascript dialog return

Hi, I've got a javascript function that draws a dialog. I'd like to have it return the value the user specifies. The problem is, the dialog is closed when a user clicks on of two buttons, which have onClick events assigned to them. The only way I know to grab these events is by assigning functions to them, which means that a return ca...

how to generate a gaussian distribution using mysql user-defined function.

I like to use MySQL to do quantitative analysis and statistics. I would like to make a MySQL user-defined function of the form: sample_gaussian(mean, stdev) that returns a single randomized value sampled from a gaussian distribution having mean and standard deviation of the user-entered arguments. MySQL already has a function rand() tha...

Javascript function error: Converting and Adding input information

I'm try to create a simple form that spits out a measurement. For Example 32 B should be (32+5)=37 I'm not sure whats wrong. Please help~ Thanks so much! <HTML> <HEAD> <TITLE>Bra Size to Chest Size</TITLE> <SCRIPT LANGUAGE="JavaScript"> function CalculateSum(Atext, Btext, form) { var A = parseFloat(Atext); var B = parseFloat(this.Cup...

How can I cache a function in asp.net

Hi, I have a function which calculates distance from database records. This function is called at least twice in one asp.net page request. In this time period the result does not change. So what to do to cache result, I need performance in my app. For example: public static int GetKilometers(int VehicleID) { /*some db query and calcula...

How to define my own functions to use in Mako templates?

How can I make my own function to use in all the Mako templates? For example, I want to create function boda(a, b) that will return a + b. (Toy example.) How can I do this? One way I know that I can do it in template itself: <% def boda(a, b): return a + b %> But I want this function to be globally available to all the templates,...

Exceptions in native PHP functions

Hi guys :) Most functions in PHP returns true/false: var_dump (is_int ("1")); // false Can I configure PHP to return exceptions instead of boolean ? try {is_int ("1")} catch (Exception $e) {exit ($e->getMessage ());} Thanks. ...

C function declaration

can we declare a function in a header file in following way? extern int ap( char[][] ); can we use char[][] in function? ...

Producing proper routes in a nested tree in codeigniter

Hi, I am pretty new to CodeIgniter and PHP in general and have two questions that are somewhat related. I have a nested category tree with unlimited depth that produces links like myapp.com/language and myapp.com/spanish but I would like to have something like myapp.com/language/spanish. For reference my model returns an array of array...

What does "..." mean in a C function declaration?

What does this mean? void message(int x, int y, ...) I can't understand what ... is. Can anybody explain? ...

Passing PHP variable value to jquery function

Hi Guys, I'm new to Jquery. I have a project that has checkboxes and if their status change, then I update some sql table. But i decided to start with the simple things first to learn how this works... So, I want to pass to a Jquery function, a php variable if a checkbox status changes. I have this code: <?php ?> <HTML> <HEAD> <...

Trying to call a function from another file

I have a function in a class file called auth_user and its in App_code folder. I am trying to call that function from random pages that are on the website. Inside the class file is a function that is simple, basicly check for flags in the sessions, i just wanna have it there so i dont have to type it again and again. I want to be able ...

Accessing javascript function properties before they are defined?

I was reading through this thread: http://stackoverflow.com/questions/61088/hidden-features-of-javascript and found this post: http://stackoverflow.com/questions/61088/hidden-features-of-javascript/61260#61260 I was playing around with the code in firebug and I found that this bit of code seems to work fine: var fn = function(x) { c...

Run fucntion on popup close - flex

I've got a flex project that I'm working on. Currently I've got a popup that consists of another mxml file containing a form. Once the form is filled in and submitted I'd like to run another function then the popup closes on the main mxml file, but I'm not sure how to go about doing this? Here's my popup code private var weightadd...

Link to text PHP

I'm already using this which I found on the net, for whenever I want to edit the information and there is already a converted link which is done by adding a new post, I need this to remove the link into text then when it's submitted to be updated, it will use this function to convert it into a link. function Links($text) { $text = ...

Sleep function uses server resources?

I've got two reasons to use a sleep function: first, to automatically send a confirmation email to a client 20 minutes after they contact us. I don't want to use cron jobs because I want it to be exactly 20 minutes (and I'm sick of my web server sending me emails telling me they initiated a cron job.....a new email every 20 minutes!) Se...

AS3: How to force parameters in callback functions

Hello, I am currently doing something like this: myFunc(tracer); function tracer(message:String):void{ trace(message); } function myFunc(callback:Function):void{ callback("Hello"); } Now, this works fine. But how can the function myFunc know, if the given callback function accepts the correct number and type of arguments in its si...

Combined average for priority and due date

Assume that a task exists with two attributes: priority and due date. Priority p is a numeric value. The priority importance increases to infinity, meaning that 5 is a priority higher than 4. Priority 0 is normal priority. Due date d is a date in the past or in the future, when compared with the current date. A d date before now is mor...

How to call a function within $(document).ready from outside it

How do you call function lol() from outside the $(document).ready() for example: $(document).ready(function(){ function lol(){ alert('lol'); } }); Tried: $(document).ready(function(){ lol(); }); And simply: lol(); It must be called within an outside javascript like: function dostuff(url){ lol(); // call ...