parameter-passing

Return Integer value from SSIS execute SQL Task

别等时光非礼了梦想. 提交于 2019-12-05 17:42:18
I am using SQL Server 2005 Business Intelligence Studio and struggling with returning an integer value from a very simple execute SQL Task. For a very simple test, I wrote the SQL Statement as: Select 35 As 'TotalRecords' Then, I specified ResultSet as ResultName = TotalRecords and VariableName = User::TotalRecords When I execute this, the statement is executed but the variable doesn't have the updated value. However, it has the default value that I specified while variable definition. The return of a date variable works, but integer variable isn't working. The type of User::TotalRecords

Excel: Passing Array to User Defined Function (VBA)

拜拜、爱过 提交于 2019-12-05 17:17:16
edit: solution - see original question below In passing arrays like {1,2,3} to a UDF I found two things to be considered: the locale - see answer 1. The list separator on a german system (usually) is ";" therefore I need to use {1 ; 2 ; 3}. the passed array appears as a 2-dimensional array within the function. Therefore it's n-th element must be targeted as myArray(n, 1 ). Disregarding this gave me the #VALUE! error. Thus, a short "select case"-UDF may look like this: Function SelCase(a1, a2, a3) For i = 1 To UBound(a2) If a2(i, 1) = a1 Then SelCase = a3(i, 1) Next End Function called like

Are nested functions possible in VBA?

青春壹個敷衍的年華 提交于 2019-12-05 16:28:09
I'm trying to clean up code by stripping parameters from a function within a private scope, like this: Function complicatedFunction(x as Double, param1 as Double, param2 as Double) ... End Function Function mainActionHappensHere(L as Double, U as Double ...) Function cleaner(x) cleaner = complicatedFunction(x, L, U) End Function ... cleaner(x) 'Many calls to this function ... End Function Is this possible? Compiler complains, "Expected End Function", since I'm beginning a function before ending the outer one. And Google is no help :( PS I can't define cleaner() outside of mainActionHappensHere

Passing arguments to another variadic function

走远了吗. 提交于 2019-12-05 16:19:25
Is there any way at all for this code to compile and work as intended without resorting to va_list stuff ? #include <iostream> void fct(void) { std::cout << std::endl; } void fct(int index, int indexes...) { std::cout << index << ' '; fct(indexes); //or fct(indexes...); ? } int main(void) { fct(1, 2, 3, 4, 5, 6, 7); return 0; } I suspect you have misunderstood the meaning of the signature void fct (int index, int indexes...) I suspect you think that fct() expect a int single value ( index ) and a variadic list of int 's ( indexex... ) with C++11 style of parameter pack expansion. No: it's the

Parameter Validation Best Practices

北战南征 提交于 2019-12-05 15:52:20
问题 Imagine you have an application which is some kind of front-end to all your business logic. This front-end has a lot of DLLs upon which it depends, and the methods in those DLLs may call each other repeatedly upon a single execution of a given method in the front-end. If the users of your application do not directly access those DLLs, should you... 1) Risk a (small) performance hit and validate parameters in each of those methods, even if you can end up validating the same parameters some 5

const or ref or const ref or value as an argument of setter function

冷暖自知 提交于 2019-12-05 15:35:00
Constantness class MyClass { // ... private: std::string m_parameter; // ... } Pass-by-value: void MyClass::SetParameter(std::string parameter) { m_parameter = parameter; } Pass-by-ref: void MyClass::SetParameter(std::string& parameter) { m_parameter = parameter; } Pass-by-const-ref: void MyClass::SetParameter(const std::string& parameter) { m_parameter = parameter; } Pass-by-const-value: void MyClass::SetParameter(const std::string parameter) { m_parameter = parameter; } Pass-by-universal-ref: void MyClass::SetParameter(std::string&& parameter) { m_parameter = parameter; } Pass-by-const

Passing strings as arguments in dplyr verbs

霸气de小男生 提交于 2019-12-05 14:55:17
问题 I would like to be able to define arguments for dplyr verbs condition <- "dist > 50" and then use these strings in dplyr functions : require(ggplot2) ds <- cars ds1 <- ds %>% filter (eval(condition)) ds1 But it throws in error Error: filter condition does not evaluate to a logical vector. The code should evaluate as: ds1<- ds %>% filter(dist > 50) ds1 Resulting in : ds1 speed dist 1 14 60 2 14 80 3 15 54 4 18 56 5 18 76 6 18 84 7 19 68 8 20 52 9 20 56 10 20 64 11 22 66 12 23 54 13 24 70 14 24

How to determine the type of a function parameter given the type of argument passed to it?

一个人想着一个人 提交于 2019-12-05 13:23:58
问题 I need a type trait which will report the type of a functor's operator() parameter given the type of the functor and the type of an argument passed to it. Basically, I need to determine precisely what type the argument will be converted to when passing it to the functor. For simplicity, let's assume that I'm only interested in a (potentially templated, potentially overloaded) operator() with a single argument. Unfortunately, I'm limited to c++03. Can it be done? If not, how about c++11? Here

Can I pass a Class type as a procedure parameter

天大地大妈咪最大 提交于 2019-12-05 13:14:45
I want to create a function that returns all the names of a certain class as a string list. Based on the previous solution / question I tried to this code with no success function GetClassElementNames (TObject ) : TStringlist ; var LCtx : TRttiContext; LMethod : TRttiMethod; begin try LCtx:=TRttiContext.Create; try // list the methods for the any class class for LMethod in LCtx.GetType(TObject).GetMethods do result.add(LMethod.Name); finally LCtx.Free; end; except on E: Exception do result.add (E.ClassName + ': ' + E.Message); end; end; Use TClass for that, which TRttiContent.GetType() expects

Passing arrays to functions in Perl

本小妞迷上赌 提交于 2019-12-05 11:55:31
问题 I think I have misunderstood some aspects of argument passing to functions in Perl. What's the difference between func(\@array) and func(@array) ? AFAIK, in both functions, arguments are passed by reference and in both functions we can change the elements of @array in the main program. So what's the difference? When should we use which? @array = (1,2,3); func(@array); func(\@array); sub func { ... } Also, how do I imitate pass-by-value in Perl? Is using @_ the only way? 回答1: AFAIK, in both