function

What is the use of the := syntax?

I'm a C# developer working on a VB.NET project, and VS keeps trying to get me to use the := thingie when I call a function with a ByRef parameter like so: While reader.Read() HydrateBookFromReader(reader:=???) . . . the HydrateBookFromReader function has the following signature: Public Function HydrateBookFromReader(ByRef reader As...

Is it possible to derive functions from functions?

I'm wondering if it is possible to derive functions from functions, similar to how classes can be derived from other classes? And if C++ does not explicitly allow this, is there a way to somehow indirectly derive functions from functions? ...

cffunction Access=

If I use access="remote" for binding a cfselect to a cfc, then I lose the ability to have an Init() constructor. <cfselect name="CityID" bind="cfc:Components.City.View1({StateID})" value="CityID" display="CityName" bindonload="yes" /> I'm used to passing the datasource name to the Init function when I instantiate a component, like so:...

How can I make the window scroll by using mouse position?

Hi, If I want to use the mouse to scroll the window when it gets close to one of the edges how can I approach this? So far I have it working fine, it checks the position whenever it moves to see if it is close enough to the edge to scroll. However, it only checks the position whenever the mouse moves, so if you moved close the edge, i...

How can I stop parent events from firing?

If I have... <div id="parent" onmouseover="doSomething()"> <div id="child" onmouseover="doSomethingElse()"> </div> </div> How can I make it so that doSomething() is not executed when I'm hovering over the child? I only want doSomethingElse() to execute when I'm hovering over the child, and I only want doSomething() to execute ...

file_get_contents or readfile for displaying filesystyem image

can anyone advise on what the best PHP function is for displaying an image stored on the filesystem - file_get_contents or readfile. We are switching from displaying images stored in the database so we still need to call the images through a PHP file and cannot link direct to the filesystem. I've seen people recommending both functions b...

How to turn a String into a javascript function call?

I got a string like: settings.functionName + '(' + t.parentNode.id + ')'; that I want to translate into a function call like so: clickedOnItem(IdofParent); This of course will have to be done in javascript. When I do an alert on settings.functionName + '(' + t.parentNode.id + ')'; it seems to get everything correct. I just need t...

How can I have the date from today show up with PHP?

I'm sending a mail function to myself. My first line reads 'Order for $name on $date' The $name variable comes from a form the user fills out. I would like the $date variable to be today's date, whatever that is on that day. How can I make the $date variable show today's date? ...

What is the best way to duplicate a calculation in Ruby & JavaScript?

I have a Ruby on Rails application and I need to duplicate some computations in both Ruby and JavaScript. Ruby is used in the server side but I also need to compute a students grade on the browser using JavaScript. My first thought is to build up a JavaScript function using strings, convert it to JSON, ship it to the browser where it i...

Are there memory efficiencies gained when code is wrapped in functions?

I have been working on some code. My usual approach is to first solve all of the pieces of the problem, creating the loops and other pieces of code I need as I work through the problem and then if I expect to reuse the code I go back through it and group the parts of code together that I think should be grouped to create functions. I...

Python: Can a variable number of arguments be passed to a function?

In a similar way to using varargs in C or C++: fn(a, b) fn(a, b, c, d, ...) ...

When to check function/method parameters?

Hi SO-lers, when writing small functions I often have the case that some parameters are given to a function which itself only passes them to different small functions to serve its purpose. For example (C#-ish Syntax): public void FunctionA(object param) { DoA(param); DoB(param); DoC(param); // etc. } private void DoA(...

Is there any way to check to see if a VBScript function is defined?

This is probably just wishful thinking... Is there any way to check to see if an ASP/VBScript function is defined before calling it? ...

Python and Qt - function reloading

Hello, i have an application class inherited from QtGui.QDialog. I have to reload show-function but save functionality. I take this idea from C#. There i could do something like this: static void show() { // My code... base.show(); } I want to do something like that but with python and qt (PyQt). Can i do that? ...

How to allow template function to have friend(-like) access?

How does one modify the following code to allow template function ask_runUI() to use s_EOF without making s_EOF public? #include <string> #include <iostream> #include <sstream> #include <vector> class AskBase { protected: std::string m_prompt; std::string m_answer; virtual bool validate(std::string a_response) = 0; public: ...

QT equivalent function for glutswapbuffers()

Please tell me what is the QT equivalent function for glutswapbuffers().. ...

Scope, using functions in current module

Hi, I know this must be a trivial question, but I've tried many different ways, and searched quie a bit for a solution, but how do I create and reference subfunctions in the current module? For example, I am writing a program to parse through a text file, and for each of the 300 different names in it, I want to assign to a category. T...

call different child function from same parent function

Im looking to have a common parent function like so void main (param 1, param 2) { <stuff to do> param1(); print("The function %s was called", param 2); <more stuff to do> } Where param 1 will be the name of the function to be called and param 2 will be some descriptive text. param 2 is easy and I have that solved, bu...

Ruby functions vs methods

In the Ruby Programming Language, Chapter 6 (second paragraph) they state: Many languages distinguish between functions, which have no associated object, and methods, which are invoked on a receiver object. Because Ruby is a purely object oriented language, all methods are true methods and are associated with at least one...

Nested functions are not allowed but why nested function prototypes are allowed? [C++]

I was reading the linked question which leads me to ask this question. Consider the following code int main() { string SomeString(); } All says, compiler takes this as a function prototype and not as a string object. Now consider the following code. int main() { string Some() { return ""; } } Compiler said...