function

Assembler mov issue

Possible Duplicate: Assembler mov issue I have the next code: mov ax,@data mov ds,ax Why I can not write just like this? mov ds,@data All source: .MODEL small .STACK 100h .DATA HelloMessage DB 'Hello, world',13,10,'$' .CODE .startup mov ax,@data mov ds,ax mov ah,9 mov dx,OFFSET Hello...

how to return a cell into a variable in sql functions.

i want to define a scaller fucntion which in that im giong to return the result into a variable but i do not know how to do this. CREATE FUNCTION dbo.Funname ( @param int ) RETURNS INT AS declare @returnvar int select @returnvar = select colname from tablename where someconditions = something return(@returnvar) i want to make a funct...

Why are PHP function calls *so* expensive?

A function call in PHP is expensive. Here is a small benchmark to test it: <?php function stringOkay($string, $maxChars) { return !isset($string[$maxChars]); } const RUNS = 1000000; // create test string $string = str_repeat('a', 1000); $maxChars = 500; // userland function call $start = microt...

boost::any, variants, calling functions based on arrays of them.

Given a set of functions, such as: template<class A1> Void Go(A1 a); template<class A1, class A2> Void Go(A1 a1, A2 a2); template<class A1, class A2, class A3> Void Go(A1 a1, A2 a2, A3 a3); Is it possible to take an array of some variant type and given its contents, fire the correct function? My application for this is that I want ...

C Parameter Array Declarators

In C99 there are variable-length arrays, and there can be static qualifiers (and type qualifiers) in parameter array declarators: void f(int i, int *a); void f(int i, int a[]); void f(int i, int a[i]); void f(int i, int a[*]); // Only allowed in function prototypes. void f(int i, int a[static i]); Since array function paramete...

JavaScript undefined function

This is really irritating. I have looked over the code continuosly but I cannot see why I am getting "undefined" thrown at me. <html> <head> <link href="../../style.css" rel="stylesheet" type="text/css"> <script type="text/javavscript"> function test() { alert("yey"); } </script> </head> <body> <div id="L1" onmo...

function vs variable declaration in C++

This code works: std::ifstream f(mapFilename.c_str()); std::string s = std::string(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>()); ParseGameState(s); Whereby mapFilename is an std::string and void ParseGameState(const std::string&);. And this does not: std::ifstream f(mapFilename.c_str()); std::string s(std::is...

Functions that can be called once only

I've been using the following approach: $foo_called = false; function foo() { if($this->foo_called) return; $this->foo_called = true; // do something. } I've been wondering if a better / different approach existed. ...

Passing a parameter from a parent to a child function

I'm trying to pass a parameter from a parent function to a child function while keeping the child function parameterless. I tried the following but it doesn't seem to work. public static function parent($param) { function child() { global $param; print($param) // prints nothing } } ...

How to check if string contains any specified words then pass an error out of the function

I've been using the below code fine for a quick and efficient function of adding BB codes in my site. function replace($text) { //User Emotions $text = str_replace(":)", "<img src=\"smiles/cool.gif\">", $text); //User formatting $text = str_replace("[center]", "<center>", $text); $text = str_replace("[/center]", "</center>", $text); $t...

Determining an Arbitrary Range of Digits in a Target Base from a Sequence and Source Base

If I have a function f that computes element m of a sequence of digits in base b, is it in general possible to write a function g that computes element n of the corresponding sequence in base c ? As a contrived example, say f produces binary and g produces hexadecimal: f(m) 1, 0, 1, 0, 1, 0, 1, 0, ... g(n) A, A, ... Now say f is i...

Confused about return statement in user defined function

hi there, i have few question regarding the return statement. a) is it compulsory to define a return statement in a user defined function.? b) is it still valid if i just define a return statement without any parameter? will it return the null value? c) is the following function valid? function admin_credential($password = 0, $email...

Common Lisp - Using a function as input to another function

Say I have a function that takes a list and does something: (defun foo(aList) (loop for element in aList ...)) But if the list is nested I want to flatten it first before the loop does stuff, so I want to use another function (defun flatten(aList)) that flattens any list: (defun foo(flatten(aList)) (loop for element in aList .....

Looking for recipe: Multiple async Ajax requests in JavaScript

I am about to spend a lot of time solving a problem, and I wonder if there is an existing recipe for this. It's a browser-based application (JavaScript and Dojo Toolkit) that is a client of a RESTful Web Service. It uses Comet to automatically update the display. There is a callback function that processes every message received. [Bo...

jQuery - parent() not working within callback function

I was testing with parent() and closest(), none work within function. TD stays the same, no change using this method: $.get('form.php', function(data){ alert(data); $(this).closest('td').html('Done!'); }); TD gets updated, this method works: $.get('form.php', function(data){ alert(data); }); $(this).closest('td').h...

can we use both virtual and new keyword in methods of c#?

Hi friends, can we use both virtual and new keyword in methods of c#? ...

How do you Include Short Functions in Awk One-Liners/Single Commands?

I know that usually you don't want one-liners/single commands to get too long but it seems like there's occasionally a longish one-liner that would benefit from replacing repetitive elements with a function. Is it possible to use a short function chop down the length of your command? For example there's no ceiling or round function ...

iPhone Function, Swap Arrays

Hi I want to put this into a function. NSMutableArray* weekArray = [[NSMutableArray alloc] init]; [weekArray addObject:@"Before School"]; [weekArray addObject:[NSString stringWithFormat:@""]]; [weekArray addObject:[NSString stringWithFormat:@""]]; [weekArray addObject:@"Break"]; [weekArray addObject:[NSString stringW...

Most efficient way to share functions among several php pages

I have about 10 dynamic php pages which use about 30 functions. Each function is needed in more than 1 page, and every page needs a different subset of functions. I've been pondering these options: 1- all functions in a single include file: every page loads unneeded code 2- each function in its own include file: too many server reques...

C# How do I use a value from one function in another?

How can I use a value from the reading function in the button1_Click function? public void reading(object sender, EventArgs e) { DialogResult reading_from_folder = new DialogResult(); reading_from_folder = folderBrowserDialog1.ShowDialog(); if (reading_from_folder == DialogResult.OK) { string[] files_in_folder = Direc...