function

TSQL table based function returning different tables

Hi, I am triyng to write a table based fuction so it returns a different results depending of the value. I have: CREATE FUNCTION [dbo].[tblfn_GetAnyDataSet_As_View] (@DataType as varchar(50)) returns table asreturn select * from (select * from table1 UNION select * from table2) DATA where DATA.DataType=@DataType and I want to up...

Python - Exists a function that is called when an object does not implement a function?

In Smalltalk there is a message DoesNotUnderstand that is called when an object does not understand a message (this is, when the object does not have the message sent implemented). So, I like to know if in python there is a function that does the same thing. In this example: class MyObject: def __init__(self): print "MyOb...

iPhone SDK function/method with arguments

I'm creating an app in which I do the same thing multiple times. I'm going for as little code as possible and I don't want to repeat myself. I need the PHP equivalant of a reusable function, where I set an input, and the function will return the output. The app is a URL shortener, so the input as you may assume is a URL, and the outpu...

Are there "Type-unsafe" function parameters in c# and how could we make one?

public List<string> Attributes = new List<string>(); public void Add(string key, string value) { if (value.ToString() != "") { Attributes.Add(key + "=\"" + value + "\" "); } } public void Add(string key, int value) { if (value.ToString() != "") { Attributes.Add(key + "=\"" + value + "\" "); } } ...

javascript function calling inside a page_load event of asp.net

hi friends How can i call a javascript function in the page_load event of a asp.net c# web application I also want to pass a variable to that javascript function. ...

SQL Execute per each result row

I've been googling around for a bit but I can't seem to find an answer to this. I'm trying to use the Database Mail in SQL Server 2005 in a stored procedure where the idea is to send separate mail for each row in a query, each mail depending on an address residing in the rows. Imagine for example 15 - 50 rows of product orders with the ...

Calling javascript from code behind

I have a c# asp.net 3.5 app I am trying to open a window from code behind after a certain event. I have this but its not working and there are no errors in firebug protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (openCredentialsWindow) { if (openCredentialsWindow_ClientI...

How to pass Id of a div that is clicked to a function that handles the click in jQuery

I want to my div ids to correspond to items in a database. Based on an id my app will pull appropriate content from a database. Hence when I use .click() to handle a click I need to pass the Id of the div being clicked to the function that handles it. How do I do this? ...

Calling methods in ObjC

hi all, I am having 8 methods in my application, and each one is calling a single method -(void)someFunction, How to know from inside the -(void)someFunction which one of those 8 methods called it ? All suggestions are appreciated. Thanks ...

JavaScript: clone a function

What is a fastest way to clone a function in JavaScript (with or without its properties)? Two options coming to mind are eval(func.toString()) and function() { return func.apply(..) }. But I am worried about performance of eval and wrapping will make stack worse and will probably degrade performance if applied a lot or applied to alread...

Function augmentation in .Net?

Hi During .Net interview, I was asked what is function augmentation. Never heard it and couldn't find anything related. Any ideas what that is in .Net? AJ ...

As2 Benchmarking

I've been looking for a took or a method of benchmarking as2 code specifically individual functions. I've looked at Grant Skinners Performance Test which is for as3 so it does me no good. Does anyone know of an as2 version or a good way to time functions? Thanks in advance! ...

Is it possible to replace a function in php (such as mail) and make it do something else?

I want to rewrite a function in PHP (let's say the mail() function), and want to make it so when I call mail() from now on, it will load my version of mail() and not the default php version. Is this possible in php? The reason I want to do this is because I have thousands of lines of code which call mail() and I don't want to rewrite al...

what is wrong in this code??

im using the following javascript function function showUser(cats1,cats2,nam_cat) { document.getElementById("eq").style.display=''; document.getElementById('eq').innerHTML = '<TABLE cellpadding="3" class="b bc r w4"><TR class="ln g"> <TD class="l"><B>'+nam_cat+' Schemes</B></TD> <TD><A HREF="#" onclick="AlphaSort(\'scheme_1_mo...

Why should functions always return the same type?

I read somewhere that functions should always return only one type so the following code is considered as bad code: def x(foo): if 'bar' in foo: return (foo, 'bar') return None I guess the better solution would be def x(foo): if 'bar' in foo: return (foo, 'bar') return () Wouldn't it be cheaper memory wise to return a None ...

PHP - Calling a static function from an extended class

Hi, Let's say I have three classes set up as follows: abstract Class A { public static function testfunction() { print_r('Hi'); } } Class B extends A { } Class C extends A { } If I call testfunction through class B or C ie B::testfunction(); Is there a way of printing out the name of the class that called it? So for examp...

[C] How to conditionally determine which functions are called at compile time?

I'm working on implementing a very, very basic component system in C, but now I am at a point where I want to 'dynamically' call some functions. The set-up is very easy: the main program is simply an endless while loop, in which some conditions are checked and in which a "process" function is called for each enabled component. For examp...

EXSLT func:return problems in xsl:for-each "loop" and func:function

My problem: I have a wealth of atom RSS feed files which have many different atom entries in them and a few overlapping entries between files. I need to find and return an entry based on a URL from any one of the RSS feeds. Technologies: This code is being run through PHP 5.2.10's XLSTProcessor extension, which uses XSLT 1, has support ...

How do you switch a jQuery function call (change actions)

I've seen this done, but I can't find an example anymore. What I'd like is to switch a jQuery action... the code below is just an example, it is not the code I am using, I'm just trying to remember how this works. var action = (getURL) ? "attr('href')" : "html()"; alert( "The result is" + $('#myLink')[action] ); I also tried var ac...

array.sort() is not giving the desired result

iam using following function in my javascript code function AlphaSort(sort_type,cat_1,cat_2,cat_nm) { var len = dataref.totalrow; var arr_name = new Array(); for (var i =0; i<len; i++) { var t = eval('dataref.mf_scheme['+i+'].'+sort_type); arr_name[i] = t; } arr_name.sort(); if(sort_type!='scheme_name') { arr_name.rever...