parameter-passing

How to parse a variable number of command line arguments with quotes into eval?

血红的双手。 提交于 2019-12-08 10:14:01
问题 I got this simple script: #!/usr/bin/env bash eval "${@:2}" while [ true ] do FocusApp=`xdotool getwindowfocus getwindowname` if [[ "$FocusApp" == *"$1"* ]]; then wmctrl -ir $(xdotool getactivewindow) -b add,maximized_vert,maximized_horz break fi done I run it like this: $ ./maximize.sh "Sublime Text" /usr/bin/subl -n "./My File With Spaces in the Name" But when I run it, Sublime Text tries to open a file named My , another named File , and etc. If I replace the eval "${@:2}" with: eval "\"$2

Passing object by unique_ptr or by value and how to implement

妖精的绣舞 提交于 2019-12-08 08:59:21
问题 I have a case that I am not sure if I should use unique_ptr or pass Object by values. Say that I have class A which has a vector Of class B and Class C has a vector of class B as well. Every time I am adding a B Object to Vector in class C it should be Removed from vector of Class C and vice versa. When Object C is destroyed all the objects in B Vector class should be add to B vector in class A class B { public: B(); virtual ~B(); }; class A { C & c; std::vector<B> bs; public: A(C & c ): c(c)

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

血红的双手。 提交于 2019-12-08 08:34:51
问题 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

symfony : Form with one parameter

∥☆過路亽.° 提交于 2019-12-08 08:03:59
问题 I have a form, and I want to pass it one parameter which must use to fill a widget. I pass the parameter in my url : url_for('myModule/new?parameter='.$myParam) I have tried to take the parameter in my action and display it in my tamplate, but it doesn't work. Action : $this->param = $request->getParameter('parameter'); Template : echo param; But I can't recover it in my form. How can I do this ? 回答1: If this parameter is needed for initializing your form then you could do it like this (keep

How to pass a line break as an argument via the system() function on Windows?

有些话、适合烂在心里 提交于 2019-12-08 07:29:31
问题 Usually one could use ^ to escape a character in the command-line. But I couldn't make it to work. Here is a test program, CommandArguments.exe, which prints the arguments it got. int main(int argc, char *argv[]) { int i, j; for (i = 0; i < argc; ++i) { printf("%d: %s\n", i, argv[i]); for (j = 0; j < strlen(argv[i]); ++j) { printf(" "); printf("%d ", argv[i][j]); } printf("\n"); } } The program in question, LineBreakCommandArguments.exe, is as follow: void main(void) { system(

View not passing Ienumerable of Model

99封情书 提交于 2019-12-08 06:56:52
问题 Edit: Removed Partial View to make things simpler. Now I just need to find out why The View isn't Posting the Values ViewModelProspectUsers public class ViewModelProspectUsers { public int Id { get; set; } public string User { get; set; } public IEnumerable<ViewModelProspectSelect> Prospects { get; set; } } ViewModelProspectSelect public class ViewModelProspectSelect { public int ProspectID { get; set; } public string Name { get; set; } public bool IsSelected { get; set; } } View @model OG

JSF 2 f:param inside of ui:repeat

瘦欲@ 提交于 2019-12-08 06:11:34
问题 as the question above mentiones, i need to create "dynamic" params for a <ui:composition> <h:link> <h:outputText value="link with params" /> <ui:repeat var="parameter" value="#{bean.getCurrentParameter}"> //customClass test: #{parameter.name} #{parameter.value} //output is fine <f:param name="#{parameter.name}" value="#{parameter.value}" /> </ui:repeat> </h:link> </ui:composition> unfortunately the "test" returns all values correctly, but when I hover the link, there is not a single parameter

Detach event handler after attaching method with passed parameter

久未见 提交于 2019-12-08 05:55:42
问题 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

Passing JSON with xmlhttpRequest request in JS

拥有回忆 提交于 2019-12-08 05:28:07
问题 I am echoing JSON from a php server back to the browser. I am quiet proficient with XML however am new to JSON. Can someone show me how to correctly extract the JSON from the xmlhttpRequest and then pass it into data aka an alert. My JSON (from PHP server) {"data": { "message": "Open the Pod bay doors, Hal", "type": "request", "replies" => array( "id": "12321" "message": "I'm sorry Dave, I'm afraid I can't do that!" ) } } My request in JS returns the JSON however I have no way of catching it

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

大城市里の小女人 提交于 2019-12-08 04:04:02
问题 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 :