parameter-passing

Use match.call to pass all arguments to other function

非 Y 不嫁゛ 提交于 2019-12-07 04:18:52
问题 From ?match.call : match.call is most commonly used in two circumstances: […] To pass most of the call to another function […] After reading that, I expected I could use match.call when I want to pass all arguments of one function to another function without listing these arguments one by one. Example: outer1 passes arguments one by one, outer2 uses match.call . outer1 <- function(a, b, c) { inner1(a, b, c) } inner1 <- function(a, b, c) { return(a + b + c$first + c$second) } outer2 <-

Javascript Prototype Chaining super class constructor and method calling

蹲街弑〆低调 提交于 2019-12-07 03:11:29
问题 I'm a newbie in the JavaScript world, and I came up with this weird problem when i was attempting prototype chaining inheritence. I have 3 classes //class parent function parent(param_1){ this.param = param_1; this.getObjWithParam = function(val){ console.log("value in parent class "+val); console.log("Constructor parameter : "+this.param); }; }; //class child function child(param_1){ this.constructor(param_1); this.getObjWithParam = function(val){ console.log("value in child class "+val);

Can you pass a fixed-size array as a GLSL function parameter?

无人久伴 提交于 2019-12-07 03:08:27
问题 In a GLSL shader, I want to create a function that looks a bit like this : void MyFunction(out float results[9]) { float value0 = 3.1546; float value1 = 42; // whatever value /* ... long, complicated code ... */ results[0] = value0; results[1] = value1; results[2] = value2; ... } Can such a function signature be used and compiled in GLSL ? If no, are there any alternatives ? 回答1: Yes, this is legal GLSL code. That doesn't mean it will certainly compile, but it is legal code. That being said,

Hudson / Jenkins: share parameters between several jobs

若如初见. 提交于 2019-12-07 02:55:07
问题 I have about 20 jobs using common parameters (user, password), and sometimes the password expires... So I have to change it on all jobs, which is really time consuming (and error prone, I may forget one). I thought about: using a kind of magic property file if that exists to have directly lines like KEY, VALUE added into job parameters adding the same kind of KEY, VALUE pair directly inside build.xml , but where ? And it's really ugly... Maybe with a dedicated XML embedded into the build.xml

How to pass any record (any type) into Delphi xe7 function as parameter?

空扰寡人 提交于 2019-12-07 02:40:29
I want to define a function that gets an record (in any type) and give us the fields of that as string. My problem is that how can I pass record to function as parameter? How to declare the parameter? Function GetRecordFields(MyRecord: any record type): string var ctx : TRttiContext; t : TRttiType; field : TRttiField; begin result := ''; ctx := TRttiContext.Create; for field in ctx.GetType(TypeInfo(MyRecord)).GetFields do begin t := field.FieldType; result := result + ' | ' + Format('Field : %s : Type : %s',[field.Name,field.FieldType.Name]); end; end; Use Generics , eg: type TRecordHlpr<T:

Pass by name and pass by value-result languages

≯℡__Kan透↙ 提交于 2019-12-07 01:53:38
问题 For my programming languages course, I'm trying to write some code snippets in languages that use pass by name or pass by value-result, preferably by default, but any language that even supports either of those would be fine. However, I haven't been able to find a single language that supports either of them. Does anyone know of a language that uses pass by value-result or pass by name? Preferably an imperative language. 回答1: The wikipedia article on evaluation strategy suggests that call-by

Detach event handler after attaching method with passed parameter

只谈情不闲聊 提交于 2019-12-07 00:32:28
I need to pass a parameter (in C#) to an event handler and then be able to detach the event handler. I attach the event handler and pass the parameter: _map.MouseLeftButtonUp += (sender, e) => _map_MouseLeftButtonUp2(sender, e, showResultsWindow); The event is called as expected. I try to detach the event handler: _map.MouseLeftButtonUp -= (sender, e) => _map_MouseLeftButtonUp2(sender, e, showResultsWindow); The code executes without error, but does not seem to detach. If I attach the event handler the more conventional way (without passing a parameter): _map.MouseLeftButtonUp+=_map

Accessing variables in a function within a function

你。 提交于 2019-12-06 23:59:34
问题 When running a function in R, I run another function within it. I have a code on the lines of this: f_a <- function(b, c){ return(b + c) } f_e <- function(){ b = 2 c = 2 d = f_a(b, c) print(d) } This works fine. What I'd like to do is not pass the variables b, c to the function f_a . I'd like to do something like this (which throws errors) f_a <- function(){ return(b + c) } f_e <- function(){ b = 2 c = 2 d = f_a() print(d) } Is there a way to do this using environments or search paths or any

How pass multiple body parameters in wcf rest using webinvoke method(Post or PUT)

荒凉一梦 提交于 2019-12-06 22:40:17
问题 I have written a REST Service in WCF in which I have created a method(PUT) to update a user. for this method I need to pass multiple body parameters [WebInvoke(Method = "PUT", UriTemplate = "users/user",BodyStyle=WebMessageBodyStyle.WrappedRequest)] [OperationContract] public bool UpdateUserAccount(User user,int friendUserID) { //do something return restult; } Although I can pass an XML entity of user class if there is only one parameter. as following: var myRequest = (HttpWebRequest

LUIS: Action Parameter cannot be passed (with Dialog Execution)

删除回忆录丶 提交于 2019-12-06 19:36:49
By using LUIS and it's "Dialog Execution" under Action Binding , i'm expecting to be able to provide the required parameter (of an Action). (So that the Action can be triggered, or the Dialog can be continued.) As far as i understand, once the Parameter has been asked to provide, we should provide it in the follow-up query call. For example: First query: https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/...?subscription-key=...&q=what are the available items Then, it asks me " Under what category? " (expecting me to provide the required parameter), like: Then i provided it in the