function

Why is one Func valid and the other (almost identical) not.

private static Dictionary<Type, Func<string, object>> _parseActions = new Dictionary<Type, Func<string, object>> { { typeof(bool), value => {Convert.ToBoolean(value) ;}} }; The above gives an error Error 14 Not all code paths return a value in lambda expression of type 'System...

What is the difference between the $get and $find functions?

What is the difference between the $get and $find functions in javascript? I'm guessing that these functions aren't really javascript-native things, so an additional question would be what are they native to? Clarification The web app I've seen this in uses jquery and ASP.NET AJAX. Perhaps that changes the meaning of these functions? ...

How to call a function from another class file

I am very familiar with writing VB based applications but am new to Xcode (and Objective C). I have gone through numerous tutorials on the web and understand the basics and how to interact with Interface Builder etc. However, I am really struggling with some basic concepts of the C language and would be grateful for any help you can offe...

Inline functions in pl/sql?

I have 5 lines of code as function which is being called 100000 times is there a way to make the function inline so that I don't experienced a call overhead in PL/SQL. Oracle 9i is the version I am using. Update: The In lining of code does not have much improvement but I gained 2 seconds though. Now I am looking for efficient version of...

How to create a sql function using temp sequences and a SELECT on PostgreSQL8

Hello there, I have this issue in either postgreSQL 8.3 or 8.4: I've created a script which (re)creates three temp sequences and then uses them to transpose some tables in order to get a single row. Now I want to put it in a FUNCTION which returns a type already created (I've done a select into and then I took the fields from the creat...

HTML, Javascript function

I have a number of input fields that accept numbers. When the calculate button is pressed, the calculations are sent to a number of other input fields with the results. I then have to go and click each of the result fields to format the contents. I would like to be able to attach code to the calculation button, in order to format all th...

JSF Custom EL function works only on the first load of the page.

I created a ( JSP-based) custom EL function to use in the rendered tag. The function will return a boolean to decide if a page component needs to be rendered on a page or not. I import it onto the jsp page using <%@ taglib uri = "/WEB-INF/mine.tld" prefix = "g" %>. Everything works perfect on the first load of the jsp page. Once a but...

JavaScript function, which reads connections between objects

I have a JavaScript literal: var members = { "mother": { "name" : "Mary", "age" : "48", "connection": { "brother" : "sun" } }, "father": { "name" : "Bill", "age" : "50" }, "brother": { "name" : "Alex", "age" : "28" } } Than I have a fun...

Pass function as parameter in PHP

Hello everybody! I've been wondering whether is possible or not to pass a function as parameter in PHP; I want something like when you're programming in JS: object.exampleMethod(function(){ // some stuff to execute }); What I want is to execute that function somewhere in exampleMethod. Is that possible in PHP? Thank you so much....

MATLAB feature function

I'm curious where to find a complete description of FEATURE function? Which arguments it accepts? No documentation was found. I heard only about memstats and getpid. Anything else? >> which feature built-in (undocumented) ...

Why isn't the compiler smarter in this const function overloading problem?

The following code does not compile: #include <iostream> class Foo { std::string s; public: const std::string& GetString() const { return s; } std::string* GetString() { return &s; } }; int main(int argc, char** argv){ Foo foo; const std::string& s = foo.GetString(); // error return 0; } I get the following error: const...

confirm only 1 time function with jquery

i have this function that will shuffle a list of images, when i press on a #shuffle button i want to trigger a message, if is confirmed the second time i will not want to ask again! how to code this? $('#shuffle').click(function(){ if(confirm('This will shuffle all your bla bla bla')){ $("#upimagesQueue li").shuffle(); }...

How to implement this feature in javascript ? Make uncertain , divorce, the wife say!

In the Javascript, could I define a class, the class itself can also when a function call, similar to the index, such as: function A() { } var a=new A(); var v=a(); //Use ordinary/like Javascript function use ...

stored values within a custom function

My program takes a data.frame and crunches the numbers. At one point, values from j-th column are multiplied by a predefined values that depends on the column name (species name, actually - it's en ecological index). So far, I've been providing these values via a second data.frame by matching column names. What would be an efficient way ...

Java - Returning a value from function !

How does returning a value from a function internally works ? See this example.. ...

How to set which of function inputs are required and which are not (C#)

So I have a function public int Sum(var valueA, var valueB, var valueC) { var summ = valueA + valueB; return summ; } I want to add to summ valueC if it was given. And let user not specify it if he does not want to. How to do such thing? ...

Best practice for error handling in codeigniter / php apps

Hi everyone, We're working with a new codeigniter based application that are cross referencing different PHP functions forwards and backwards from various libraries, models and such. We're running PHP5 on the server and we try to find a good way for managing errors and status reports that arises from the usage of our functions. While ...

[C++] My First Go With Function Templates

Thought it was pretty straight forward. But I get a "iterator not dereferencable" errro when running the below code. What's wrong? template<typename T> struct SumsTo : public std::binary_function<T, T, bool> { int myInt; SumsTo(int a) { myInt = a; } bool operator()(const T& l, const T& r) { c...

how to pass an array into an function and in the function count how many numbers are in a range?

#include <iostream> #include <fstream> using namespace std; int calculate_total(int exam1[], int exam2[], int exam3[]); // function that calcualates grades to see how many 90,80,70,60 int exam1[100];// array that can hold 100 numbers for 1st column int exam2[100];// array that can hold 100 numbers for 2nd column ...

When declaring a function in C++/CLI, what is the meaning of the signs ^ and * before and after a variable?

For example: Let's say we have a class called MyClass. String^ MyClass::GetSomeInfoForExamplePuprs( int InfoNumber ) { } or static String ^GetOtherInfoExample() { } or String ^GetOtherInfoExample(object *Something) { } I saw it in source code and can't figure it out. ...