function

How to calcuate elapsed time in terms of minutes in MySQL

There is a time stamp column/field in a table, and the format is like 2009-12-05 10:35:28, Now I want to get the time in terms of minutes(How many minutes have elapsed) elapsed from then on, how to do it? ...

MS Access : Read form control value in a module's function

I have an Access database with a form in which a user clicks a button which in turn runs a macro which also runs a function in a module. Yes, convoluted and no, I am not allowed to change much since it's the customer's application. What I need is to read some combo-boxes and a radio button from the form in the function that's in the mod...

Simple Automatic Classification of the (R-->R) Functions

Given data values of some real-time physical process (e.g. network traffic) it is to find a name of the function which "at best" matches with the data. I have a set of functions of type y=f(t) where y and t are real: funcs = set([cos, tan, exp, log]) and a list of data values: vals = [59874.141, 192754.791, 342413.392, 1102604.284...

Replacing a function definition in C

Possible Duplicate: What is the best solution to replace a new memory allocator in an existing code? I'm writing a library in C. I'd like to know if there is a way to divert every malloc() call my library makes to a different "augmented" testmalloc() function that I provide without (significantly) modifying my library. This qu...

Generics and Functions in C#

Here is some code, it won't compile but essentially want I want to create is a function that parses as CSV file and then converts the values in the CSV list to a specific type. Func<string, Func<string,T>, IEnumerable<T>> parser =(string csv, Func<string, T> newFunc) => { List<T> items = new List<T>(); string[] a...

Javascript file- is function in error? Need help!

I am trying to see if my JavaScript file's function is written correctly in order to display "Sunday, December 24, 2006". So here is the function: function XmasDays(thisDate) { var XMYear = thisDate.getFullYear(); var XMDay = new Date("December, 25, 2005"); XMDay.setFullYear(XMYear); var dayTotal = (XMDay-thisDat...

help with passing arguments to function

function get_tags_by_criteria($gender="%", $min_age_of_birth="%", $max_age_of_birth="%", $country="%", $region="%", $city="%", $tag="") { when i just want to pass the tag argument and let the others by default, how do i write? ive tried this but it didnt work. get_tags_by_criteria("", "", "", "", "", "", computer); ...

In python is there a way to check if a function is a "generator function" before calling it?

Lets say I have two functions: def foo(): return 'foo' def bar(): yield 'bar' The first one is a normal function, and the second is a generator function. Now I want to write something like this: def run(func): if is_generator_function(func): gen = func() gen.next() #... run the generator ... else: func() ...

Select query causing exception

When does the below sql function can cause an exception other than NO DATA FOUND? v_ExchangeRate is of type float.The datatype of rate column is NUMBER(14, 10) and this column can not contain NULL values. BEGIN SELECT rate INTO v_ExchangeRate FROM exchange_rate WHERE currency_code = CurrencyCode AND status = 'A'; The data type ...

Problem with class variables , to use them in if block in function

I am having problem in accessing variables in class here's the code class Text { private $text = ''; private $words = ''; // function to initialise $words private function filterText($value,$type) { $words = $this->words; echo count($words); // works returns a integer if($type == ...

How to disable eval function without going to php.ini file?

Hello All, Is there a way to disable eval function without doing so from php.ini file. I have tried ini_set function but even that doesn't work. Basically I want my framework users to decide whether this function should be enabled or not through a config file. If they say no, i should be able to disable it using code as i can't go to s...

Extract default namespaceID from XML file

I have a file that contains a default namespace declaration, first few lines of one such here: <?xml version="1.0" encoding="UTF-8"?> <dodavka xmlns="urn:CZ-RVV-IS-VaV-XML-NS:data-1.2.2" xmlns:v="urn:xmlns:mathan.vklap.annotations-1.0" v:faze="finalni" struktura="RIV09A"> <zahlavi v:posledni-zmena="06.09.2009 21:28 +0200 1.4.46"> ...

Passing objects/references as function parameters

EDIT: Language is PHP. So, I'm implementing a listener/observer pattern. One of the objects I implemented was an object for including files. Which works in a way like this: class IncludeEvent extends Event { protected $File = ''; public $Contents; .... public function Begin() { .... // this is the ONLY t...

Benefits of declaring a function as "inline"?

Every time I read about the "inline" declaration in C it is mentioned that it is only a hint to the compiler (i.e. it does not have to obey it). Is there any benefit to adding it then, or should I just rely on the compiler knowing better than me? ...

jQuery - Save Function Result Into a Variable

I have this function, which loads a select from a database. function Competition() { $(document).ready(function() { $.ajax({ url: "load-comp.php", cache: false, success : function(html) { // something here } }); EditRow(); }); } I need to put that select ins...

need base64 encode/decode in c

I need a function to encode base64 and a function to decode base64 string in c. I found http://base64.sourceforge.net/b64.c but the functions work on files, not strings, and add line breaks. I need one that simply encodes/decodes strings. Where can I find such a sourcecode? ...

functions that produce lists of lists in scheme

Hi, I'm trying to use scheme to write a function f that takes a number n and a function g and returns a list of lists of length n, but according with booleans according to the pattern indicated by g. For example, the function f should take n say 3 and the function g which makes every 3rd item on the list a true. It should return this: ...

C/C++ default argument set as a previous argument

I was unable to find a clear answer to this although that might be because I was not using the proper search terms so please redirect me if that is the case. Is it possible to use previous arguments in a functions parameter list as the default value for later arguments in the parameter list? For instance, void f( int a, int b = a, int...

How to find the variables defined in a function.

Suppose I have a long javascript function such as function test() { var x; var a; ... ... ... ... ... } is there any way I can ask the function itself to tell me what variables were defined so far. function test() { var x; var a; ... ... ... ... ... // bit of code that would say to ...

Split String at specific character

I have the following code: var string = "word1;word2;word3,word4,word5,word6.word7"; function ends_with(string, character) { var regexp = new RegExp('\\w+' + character, 'g'); var matches = string.match(regexp); var replacer = new RegExp(character + '$'); return matches.map(function(ee) { return ee.replace(replacer, ''); }...