function

jQuery - Own plugin - need small help

Hey again all :) I created my own jQuery plugin in 1.4 and now I need a small amount of help. $.etrade = function() { } I need so I can build code like this $.etrade = function() { this.var = 'setting'; this.subfunction = function() { }; } when I take function from my plugin I need to use it like this: $.etrade....

Two really similar classes in C++ with only one different method: how to implement?

Hi all, I have two classes that are almost identical, besides one method. The classes have the same data part and all the member functions but one: class A { private: double data; public: double calc(){ return data*data; } double especific(){ return 2.0*data; } } and the second class is identical, besides the es...

Wildcards in PHP functions

I am not sure if the term "Wildcard" can explain my point, but sometimes in some ready scripts we are able to call a non defined function like find_by_age(23) where age can be anything else that's mapped to a database table record. So i can call find_by_name, find_by_email, find_by_id and so on. So how can we do such thing either in proc...

Groovy - Cleaning up functions

Hi guys, I have a gross looking function and am wanting to clean it up. All it contains is some maps, a for loop, and if statements. Basically I have a map that I would like to grab only certain information from but one of the keys that I need from it changes by one number in each map. I was thinking maybe a simple switch statement or...

global variable in R function

I created a function for processing some of my data, like this: a <- "old" test <- function (x) { assign(x, "new", envir = .GlobalEnv) } test(a) But I can't see the a change from "old" to "new", I guess this is some of the "global variable", any suggestion? Thanks! ...

callback functions

Man Im trying to understand callback functions. Ive been over many articles and posts here on SO. The explanations seem circular and I think Im actually getting farther from understanding lol. Ive used them apparently in javascript events, but its more a 'memorize these lines' than 'this is whats going on and why' sort of understanding. ...

Reusable Page_PreRender function in asp.net

I have a function which sets my linkbutton as the default button for a panel. protected void Page_PreRender(object sender, EventArgs e) { string addClickFunctionScript = @"function addClickFunction(id) { var b = document.getElementById(id); if (b && typeof(b.click) == 'undefined') ...

Accessing an array element when returning from a function

Some searching through Google (and my own experience) shows that in PHP you can't grab an array element when it's been returned from a function call on the same line. For example, you can't do: echo getArray()[0]; However, I've come across a neat little trick: echo ${!${false}=getArray()}[0]; It actually works. Problem is, I do...

jQuery: using 2 functions with table

hi all, i made a little listview widget which uses a table and assigned a function to its rows like: $("tr",myTable).bind("click",function(){ selectRow($(this)); }); i now would like to apply another function called deleteRow, but only to each row's last cell: $("td:last-child",myTable).bind("click",function(){ deleteRow($(t...

How do i access a class instance's parent in PHP ?

The only object oriented programming experience I have is from C#, so PHP is throwing me some curve balls I could use some help with. I have a class I use for all my pages, the "pagebase" if you will. It handles the lowest level html structure. That class is inherited by several other classes. Those classes are the different page types ...

How to return a class variable as a reference (&/ampersand) in PHP?

This is sample of my code. class SomeClass extends SomeOtherClass { function __construct($input) { parent::__construct($input); $this->conn = new mysqli('a','b','c','d'); } function getConnection() { return &$this->conn; } } My main object is that i want to return the MySQLi connection by referencing it instead of creating another ...

String functions missing in Xalan 2.7, java.lang.String used instead?!

I am using Xalan 2.7.0 (as bundled with Apache FOP 1.0) and have problems when using string functions. The line <xsl:value-of select="fn:replace('test', 't', '*')"/> results in this exception: javax.xml.transform.TransformerException: java.lang.IllegalArgumentException: argument type mismatch at org.apache.fop.cli.InputHandler.tran...

JavaScript: Can you substitute variables into anonymous functions on creation?

Possible Duplicate: Javascript closure inside loops - simple practical example Rather than explaining the question, I'll give an example: for (var i = 0; i < 100; i ++) { get_node(i).onclick = function() { do_something_very_important(i); } } Is there any way to have the value of i substituted into the function upon ...

Getting Function to take value in array as an input JAVA

I am trying to get a function in JAVA to take a value in an array as input. Here is my attempt: public static void main(String[]args) { int [] a = new int [4]; a[0]=6; a[1]=7; a[2]=5; a[3]=2; int g = 11; System.out.println calc(a[0], 11); } public static int calc(a[], int g) I am doing this before running a...

Getting a function to return two integers

I am writing a function and I want it two return two integers as results. However, I cannot get it to do this. Could someone help me? Here is my best shot public static int calc (int s, int b, int c, int d, int g) { if (s==g) return s; else if (s+b==g) return s && b; else if (s + ...

A function to capture all MySQL errors?

Hi, Does anyone have a PHP function that for example if a mysql_error() happens due to well a MySQL error it will not output it? By not output it I mean rather it not show the error on live site as I will use it with another function I have that would work a treat if I had a MySQL error function. I am just finding it so annoying as I ...

Pass from PHP to Javascript

Hi All, I have a little problem here, and no tutorials have been of help, since I couldn't find one that was directed at this specific problem. I have 2 hosting accounts, one on a server that supports PHP. And the other on a different server that does not support PHP. SERVER A = PHP Support, and SERVER B = NO PHP Support. On server a...

Why does the sum of 2 parseFloat variables give me an incorrect decimal number

If I have this little function: <script type="text/javascript"> function printFloat(){ var myFloatNumber1 = document.getElementById('floatNumber1'); var myFloatNumber2 = document.getElementById('floatNumber2'); alert(parseFloat(myFloatNumber1.value) + parseFloat(myFloatNumber2.value)) } </script> <input type="text...

EXCEL VLOOKUP FUNCTION | When switching to another doc, Function Argument window disappears?

Hello! I have problem with Excel 2007 when using VLOOKUP function. After switching to another document for referencing value in "Table_array" field, window dissapears. Google finds some results about the problem, but nothing helpful. Following things have already been considered: - Security problems (Trusted center is OK, settings too...

Sql Server deterministic user-defined function

I have the following user-defined function: create function [dbo].[FullNameLastFirst] ( @IsPerson bit, @LastName nvarchar(100), @FirstName nvarchar(100) ) returns nvarchar(201) as begin declare @Result nvarchar(201) set @Result = (case when @IsPerson = 0 then @LastName else case when @FirstName = '' then @LastName el...