Coldfusion GetComponentMetaData functions order - coldfusion

The functions list returned by GetComponentMetaData seems to be ordered randomly. Is there any way to get the proper order of functions as defined in the cfc? Thanks.

Related

Get list of available functions from exprtk::symbol_table

I would like to query all available function names from a symbol_table. I can see that symbol_table has methods for getting variables, vectors, and stringvars (i.e. symbol_table::get_variable_list). However, I don't see a corresponding symbol_table::get_function_list. Is there some other way that I can get this information?

Postman| Is there a way to set a function globally to work in all Collections?

I am trying to set a function to work in all of my collections in Postman.
Each of my collections has different environment, and I want to set the function only once to use it on all of my collections so I won't have to copy the function to each one of them.
I have found solutions that makes functions as global through requests in the same collections, but not over all of the collections.
Thanks in advance.

Google Mock: obtain AssertionResult from EXPECT_THAT

I'm trying to write a google-test utility function which performs some setup steps base on it's input arguments and finally compares the contents of two containers irrespective of order. I would then like to return a ::testing::AssertionResult from this function based on whether the container contents are equal.
For the comparison itself I would like to use functionalities provided by google-mock in order to avoid errors in my own test-code and reduce developement overhead. Something like the following would work:
EXPECT_THAT(actual_container,
testing::UnorderedElementsAreArray(expected_container))
<< "Container content equal.";
The trouble with this is that I'm not sure if it is even possible to
obtain an AssertionResult which can be returned from a function in a similar manner.
Does anyone have a solution to this or a suggestion for an alternative approach?

Calling a function or method by reflection in C/C++

I am just going through a problem that I haven't before in C/C++, and I have no idea how to solve it. Reflection. I need to call a function or method by a string that was given by the user. Not just this, I also need to give the function or method some parameters and get its result if any.
Imagine the user has typed printSomething.
I need to evaluate "printSomething"(paramA, paramB). Of course, the function or method T printSomething() is defined.
How is the best way I can do it?
Use a structure mapping from strings to pointers to functions or methods (member functions).
C++ doesn't provide such a structure; you will have to build it yourself, passing in the name-strings and the pointers. Conversion of parameters and return values to and from strings also needs to be implemented. The language has no conventions or ideas about how this is to be done, so you must specify it.

Lua: how to verify that a table contains a specific function

I'm developing a module that returns a table full of functions based on the arguments that are passed in. Specifically, the module returns a set of data transformation rules (functions) that need to be applied to a data set depending on which customer is sending it.
I decided to decouple my rule library (biz logic) from the code that decides which of the rules should be applied (config logic).
Here's the unit test I'm writing to verify that the ruleBuilder is adding the correct rule (function) based on one of my scenarios:
ruleBuilder = require("ruleBuilder")
ruleLibrary = require("ruleLibrary")
local rules = ruleBuilder.assembleRules("Customer1231")
assert(rules[1] == ruleLibrary.missingSSNRule)
Is this the correct way to do that verification? Will this work even if the ruleLibrary.missingSSNRule function has references to several other functions via a closure or parameter?
To verify that a table contains a particular function you may use the fact that keys in Lua tables can be anything (including functions). In your assembleRules code you can write something like this:
function assembleRules(...)
...
return {
[someOtherCoolModule.coolFunction] = someOtherCoolModule.coolFunction,
[yetAnotherModule.anotherFunction] = yetAnotherModule.anotherFunction,
}
end
Then later you can simply check if the key exists:
local rules = ruleBuilder.assembleRules("somedata")
assert(rules[someOtherCoolModule.coolFunction])
On the assumption that the return value of ruleBuilder.assembleRules is supposed to somehow know to put someOtherCoolModule.coolFunction in the 0-th index (note: Lua uses 1-based indices. Don't use 0 as an index) of its return value, then yes.
Will this work even if someOtherCoolModule.coolFunction is a closure?
All functions in Lua are closures. However, I'm going to assume that you mean that ruleBuilder.assembleRules is going to take someOtherCoolModule.coolFunction and build a new function around it.
A function is equal to itself. But it is only equal to itself. Just like two tables are only equal if they are the same table object, two functions are only equal if they are the same function. Functions are not equal to a different instantiation of the same function, nor is it equal to any other function. Here are examples of this.